Fix a faulty optimization on FP values

llvm-svn: 11801
This commit is contained in:
Chris Lattner 2004-02-24 18:10:14 +00:00
parent a92e58610d
commit 8ee0593f0d
1 changed files with 2 additions and 1 deletions

View File

@ -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