summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index 17ca01d4aa9..9df0d4673b8 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -1316,10 +1316,11 @@ static Instruction *foldFDivConstantDivisor(BinaryOperator &FDiv) {
return BinaryOperator::CreateFMul(FDiv.getOperand(0), RecipCFP);
}
-/// Try to strength-reduce C / X expressions where X includes another constant.
+/// Try to reassociate C / X expressions where X includes another constant.
static Instruction *foldFDivConstantDividend(BinaryOperator &I) {
Constant *C1;
- if (!I.isFast() || !match(I.getOperand(0), m_Constant(C1)))
+ if (!I.hasAllowReassoc() || !I.hasAllowReciprocal() ||
+ !match(I.getOperand(0), m_Constant(C1)))
return nullptr;
Value *X;
OpenPOWER on IntegriCloud