diff options
author | Owen Anderson <resistor@mac.com> | 2014-01-16 20:59:41 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2014-01-16 20:59:41 +0000 |
commit | da5e148474e717918af06024d0b2ead54373f3f9 (patch) | |
tree | a4e21b4816aef37e8f24da8b9bd95b26f0c6c1ef /lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | |
parent | 4b81ee4d9a115eb1f1edd6a938392ed75290ec8d (diff) | |
download | llvm-da5e148474e717918af06024d0b2ead54373f3f9.tar.gz llvm-da5e148474e717918af06024d0b2ead54373f3f9.tar.bz2 llvm-da5e148474e717918af06024d0b2ead54373f3f9.tar.xz |
Fix a bug in InstCombine where we failed to preserve fast math flags when optimizing an FMUL expression.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199424 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineMulDivRem.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index 6c34b1bf56..94461c5f84 100644 --- a/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -525,8 +525,11 @@ Instruction *InstCombiner::visitFMul(BinaryOperator &I) { Value *N1 = dyn_castFNegVal(Opnd1, IgnoreZeroSign); // -X * -Y => X*Y - if (N1) - return BinaryOperator::CreateFMul(N0, N1); + if (N1) { + Value *FMul = Builder->CreateFMul(N0, N1); + FMul->takeName(&I); + return ReplaceInstUsesWith(I, FMul); + } if (Opnd0->hasOneUse()) { // -X * Y => -(X*Y) (Promote negation as high as possible) |