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

Duncan Sands baldrick at free.fr
Wed Dec 12 08:11:58 PST 2012


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?

> -  }
> +  if (Value *V = SimplifyFAddInst(LHS, RHS, I.getFastMathFlags(), TD))
> +    return ReplaceInstUsesWith(I, V);
>
>     // -A + B  -->  B - A
>     // -A + -B  -->  -(A + B)

Ciao, Duncan.



More information about the llvm-commits mailing list