diff options
author | Michael Ilseman <milseman@apple.com> | 2012-12-12 20:59:36 +0000 |
---|---|---|
committer | Michael Ilseman <milseman@apple.com> | 2012-12-12 20:59:36 +0000 |
commit | 94993e37c608d060ea2c60176f62f62291850293 (patch) | |
tree | 453c24251d970a8abd83a5b9a9bf0d8f2c063566 | |
parent | 8b65f82292111ed95d7e05257edf0c1e3a0633f6 (diff) |
Restore the PHI optimization I accidently removed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170024 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineAddSub.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/lib/Transforms/InstCombine/InstCombineAddSub.cpp index c22249527b..01a3c48635 100644 --- a/lib/Transforms/InstCombine/InstCombineAddSub.cpp +++ b/lib/Transforms/InstCombine/InstCombineAddSub.cpp @@ -354,6 +354,10 @@ Instruction *InstCombiner::visitFAdd(BinaryOperator &I) { if (Value *V = SimplifyFAddInst(LHS, RHS, I.getFastMathFlags(), TD)) return ReplaceInstUsesWith(I, V); + if (isa<PHINode>(LHS)) + if (Instruction *NV = FoldOpIntoPhi(I)) + return NV; + // -A + B --> B - A // -A + -B --> -(A + B) if (Value *LHSV = dyn_castFNegVal(LHS)) |