aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMichael Ilseman <milseman@apple.com>2012-12-12 20:59:36 +0000
committerMichael Ilseman <milseman@apple.com>2012-12-12 20:59:36 +0000
commit94993e37c608d060ea2c60176f62f62291850293 (patch)
tree453c24251d970a8abd83a5b9a9bf0d8f2c063566 /lib
parent8b65f82292111ed95d7e05257edf0c1e3a0633f6 (diff)
downloadexternal_llvm-94993e37c608d060ea2c60176f62f62291850293.zip
external_llvm-94993e37c608d060ea2c60176f62f62291850293.tar.gz
external_llvm-94993e37c608d060ea2c60176f62f62291850293.tar.bz2
Restore the PHI optimization I accidently removed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170024 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/InstCombine/InstCombineAddSub.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/lib/Transforms/InstCombine/InstCombineAddSub.cpp
index c222495..01a3c48 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))