summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-24 18:10:14 +0000
committerChris Lattner <sabre@nondot.org>2004-02-24 18:10:14 +0000
commit8ee0593f0dff9a06572743ad2ab4e7634078bec3 (patch)
tree017d7248f37ee3ff586332f64db1679d065926fb /llvm/lib/Transforms
parenta92e58610df3b1f577296b74aed520a22b61bba6 (diff)
downloadbcm5719-llvm-8ee0593f0dff9a06572743ad2ab4e7634078bec3.tar.gz
bcm5719-llvm-8ee0593f0dff9a06572743ad2ab4e7634078bec3.zip
Fix a faulty optimization on FP values
llvm-svn: 11801
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index fb7dc984923..322112a942e 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud