diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-24 18:10:14 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-24 18:10:14 +0000 |
commit | d38f208cd97832babc72abe0f4887fbcb5d44b11 (patch) | |
tree | e2a85e990f6657f7e41d536f271d032ee9661d5f | |
parent | 6e4ca614380bdbbf051562f05560024d35aeccfe (diff) |
Fix a faulty optimization on FP values
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11801 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index fb7dc98492..322112a942 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -441,7 +441,8 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) { Value *LHS = I.getOperand(0), *RHS = I.getOperand(1); // X + 0 --> X - if (RHS == Constant::getNullValue(I.getType())) + if (!I.getType()->isFloatingPoint() && // -0 + +0 = +0, so it's not a noop + RHS == Constant::getNullValue(I.getType())) return ReplaceInstUsesWith(I, LHS); // X + X --> X << 1 |