[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Oct 17 10:56:49 PDT 2005
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.386 -> 1.387
---
Log message:
Oops, X+0.0 isn't foldable, but X+-0.0 is.
---
Diffs of the changes: (+5 -4)
InstructionCombining.cpp | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.386 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.387
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.386 Mon Oct 17 12:49:32 2005
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Oct 17 12:56:38 2005
@@ -694,11 +694,12 @@
return ReplaceInstUsesWith(I, RHS);
// X + 0 --> X
- // NOTE: -0 + +0 = +0 in non-default rounding modes. When we support them
- // we must disable this. Note that 0.0-0.0 = -0.0, so this doesn't hold
- // for SUB.
- if (RHSC->isNullValue())
+ if (!I.getType()->isFloatingPoint()) { // NOTE: -0 + +0 = +0.
+ if (RHSC->isNullValue())
+ return ReplaceInstUsesWith(I, LHS);
+ } else if (cast<ConstantFP>(RHSC)->isExactlyValue(-0.0)) {
return ReplaceInstUsesWith(I, LHS);
+ }
// X + (signbit) --> X ^ signbit
if (ConstantInt *CI = dyn_cast<ConstantInt>(RHSC)) {
More information about the llvm-commits
mailing list