From: Michael Ilseman Date: Wed, 12 Dec 2012 20:59:36 +0000 (+0000) Subject: Restore the PHI optimization I accidently removed X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=94993e37c608d060ea2c60176f62f62291850293;p=oota-llvm.git Restore the PHI optimization I accidently removed git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170024 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/lib/Transforms/InstCombine/InstCombineAddSub.cpp index c22249527b9..01a3c48635a 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(LHS)) + if (Instruction *NV = FoldOpIntoPhi(I)) + return NV; + // -A + B --> B - A // -A + -B --> -(A + B) if (Value *LHSV = dyn_castFNegVal(LHS))