diff options
author | Sanjay Patel <spatel@rotateright.com> | 2018-02-19 21:46:52 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2018-02-19 21:46:52 +0000 |
commit | 1d14779aed200632328b38b04a89575b0a89c38b (patch) | |
tree | 44adc1b1490c79508a8ff0d75ac581ea08f499e7 /llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | |
parent | 49a9d1a4e6f06299f6c87d693e585d388808f643 (diff) | |
download | bcm5719-llvm-1d14779aed200632328b38b04a89575b0a89c38b.tar.gz bcm5719-llvm-1d14779aed200632328b38b04a89575b0a89c38b.zip |
[InstCombine] allow fdiv with constant dividend folds with less than full -ffast-math
It's possible that we could allow this either 'arcp' or 'reassoc' alone, but this
should be conservatively better than what we have right now. GCC allows this with
only -freciprocal-math.
The last test is changed to show a case that is expected to fold, but we need D43398.
llvm-svn: 325533
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | 5 |
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; |