diff options
author | Chris Lattner <sabre@nondot.org> | 2005-10-17 20:18:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-10-17 20:18:38 +0000 |
commit | 8532cf6258b6f62de2787f1b22b6325d64924b6d (patch) | |
tree | f878356b7fee388615d16a041e2de7326caabc7c | |
parent | 5e678e03b72487d53117b05d23fd23f29bd8c344 (diff) |
Make this work for FP constantexprs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23773 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index d92e126b08..f4d44a1775 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -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 |