[llvm-commits] [llvm] r170024 - /llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp

Michael Ilseman milseman at apple.com
Wed Dec 12 14:29:37 PST 2012


On Dec 12, 2012, at 2:27 PM, Eli Friedman <eli.friedman at gmail.com> wrote:

> On Wed, Dec 12, 2012 at 12:59 PM, Michael Ilseman <milseman at apple.com> wrote:
>> Author: milseman
>> Date: Wed Dec 12 14:59:36 2012
>> New Revision: 170024
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=170024&view=rev
>> Log:
>> Restore the PHI optimization I accidently removed
>> 
>> Modified:
>>    llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
>> 
>> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp?rev=170024&r1=170023&r2=170024&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp (original)
>> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp Wed Dec 12 14:59:36 2012
>> @@ -354,6 +354,10 @@
>>   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))
> 
> Test?
> 

Sure, I'll write one up

> -Eli




More information about the llvm-commits mailing list