1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

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 b086ac893e
commit fc15346b60

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