Make this work for FP constantexprs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23773 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-10-17 20:18:38 +00:00
parent 5e678e03b7
commit 8532cf6258

View File

@ -697,8 +697,9 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
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);
} else if (ConstantFP *CFP = dyn_cast<ConstantFP>(RHSC)) {
if (CFP->isExactlyValue(-0.0))
return ReplaceInstUsesWith(I, LHS);
}
// X + (signbit) --> X ^ signbit