[llvm-commits] [llvm] r169941 - in /llvm/trunk/lib/Transforms/InstCombine: InstCombineAddSub.cpp InstCombineMulDivRem.cpp

Michael Ilseman milseman at apple.com
Wed Dec 12 12:58:38 PST 2012


On Dec 12, 2012, at 8:11 AM, Duncan Sands <baldrick at free.fr> wrote:

> Hi Michael,
> 
> On 12/12/12 01:28, Michael Ilseman wrote:
>> Author: milseman
>> Date: Tue Dec 11 18:28:32 2012
>> New Revision: 169941
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=169941&view=rev
>> Log:
>> Remove redunant optimizations from InstCombine, instead call the appropriate functions from SimplifyInstruction
>> 
>> Modified:
>>     llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
>>     llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
>> 
>> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp?rev=169941&r1=169940&r2=169941&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp (original)
>> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp Tue Dec 11 18:28:32 2012
>> @@ -351,18 +351,8 @@
>>    bool Changed = SimplifyAssociativeOrCommutative(I);
>>    Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
>> 
>> -  if (Constant *RHSC = dyn_cast<Constant>(RHS)) {
>> -    // X + 0 --> X
>> -    if (ConstantFP *CFP = dyn_cast<ConstantFP>(RHSC)) {
>> -      if (CFP->isExactlyValue(ConstantFP::getNegativeZero
>> -                              (I.getType())->getValueAPF()))
>> -        return ReplaceInstUsesWith(I, LHS);
>> -    }
>> -
>> -    if (isa<PHINode>(LHS))
>> -      if (Instruction *NV = FoldOpIntoPhi(I))
>> -        return NV;
> 
> did you mean to zap this phi node optimization too?
> 

Doh! I think you even pointed that out from the review. I'll get right on that!

>> -  }
>> +  if (Value *V = SimplifyFAddInst(LHS, RHS, I.getFastMathFlags(), TD))
>> +    return ReplaceInstUsesWith(I, V);
>> 
>>    // -A + B  -->  B - A
>>    // -A + -B  -->  -(A + B)
> 
> Ciao, Duncan.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list