aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-10-17 17:49:32 +0000
committerChris Lattner <sabre@nondot.org>2005-10-17 17:49:32 +0000
commit560a17d3bc8d3a3f6be179d428d31abd64498283 (patch)
tree49f21b16878d9c483da2c6f39c667271868ada2c
parenta1ff93159af2fbe085f7840337e2a25b09aa47ec (diff)
relax this a bit, as we only support the default rounding mode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23771 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index cf4af79169..67a54018c3 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -694,8 +694,10 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
return ReplaceInstUsesWith(I, RHS);
// X + 0 --> X
- if (!I.getType()->isFloatingPoint() && // -0 + +0 = +0, so it's not a noop
- RHSC->isNullValue())
+ // 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())
return ReplaceInstUsesWith(I, LHS);
// X + (signbit) --> X ^ signbit