mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
LICM: Reorder condition checks
Check the fast math flag before the more expensive loop check.
This commit is contained in:
parent
583ac72b46
commit
1e680749e8
@ -818,9 +818,8 @@ bool llvm::hoistRegion(DomTreeNode *N, AliasAnalysis *AA, LoopInfo *LI,
|
|||||||
|
|
||||||
// Attempt to remove floating point division out of the loop by
|
// Attempt to remove floating point division out of the loop by
|
||||||
// converting it to a reciprocal multiplication.
|
// converting it to a reciprocal multiplication.
|
||||||
if (I.getOpcode() == Instruction::FDiv &&
|
if (I.getOpcode() == Instruction::FDiv && I.hasAllowReciprocal() &&
|
||||||
CurLoop->isLoopInvariant(I.getOperand(1)) &&
|
CurLoop->isLoopInvariant(I.getOperand(1))) {
|
||||||
I.hasAllowReciprocal()) {
|
|
||||||
auto Divisor = I.getOperand(1);
|
auto Divisor = I.getOperand(1);
|
||||||
auto One = llvm::ConstantFP::get(Divisor->getType(), 1.0);
|
auto One = llvm::ConstantFP::get(Divisor->getType(), 1.0);
|
||||||
auto ReciprocalDivisor = BinaryOperator::CreateFDiv(One, Divisor);
|
auto ReciprocalDivisor = BinaryOperator::CreateFDiv(One, Divisor);
|
||||||
|
Loading…
Reference in New Issue
Block a user