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 | 3c814128cdb8728baa06acaeae484e601f8bd636 (patch) | |
tree | f9d827e641fe08c83271722822f56acbd2ba2680 /llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp | |
parent | a3619d31d8bff8589ced391e9032cce139957e8a (diff) | |
download | bcm5719-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.cpp | 4 |
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)) |