summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
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
commit3c814128cdb8728baa06acaeae484e601f8bd636 (patch)
treef9d827e641fe08c83271722822f56acbd2ba2680 /llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
parenta3619d31d8bff8589ced391e9032cce139957e8a (diff)
downloadbcm5719-llvm-3c814128cdb8728baa06acaeae484e601f8bd636.tar.gz
bcm5719-llvm-3c814128cdb8728baa06acaeae484e601f8bd636.zip
Restore the PHI optimization I accidently removed
llvm-svn: 170024
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
index c22249527b9..01a3c48635a 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
+++ b/llvm/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))
OpenPOWER on IntegriCloud