[llvm-commits] [llvm] r122326 - in /llvm/trunk: lib/Analysis/InstructionSimplify.cpp test/Transforms/InstSimplify/ test/Transforms/InstSimplify/2010-12-20-Reassociate.ll test/Transforms/InstSimplify/dg.exp

Duncan Sands baldrick at free.fr
Wed Dec 22 01:33:24 PST 2010

Hi Chris,

>> Add generic simplification of associative operations, generalizing
>> a couple of existing transforms.  This fires surprisingly often, for
>> example when compiling gcc "(X+(-1))+1->X" fires quite a lot as well
>> as various "and" simplifications (usually with a phi node operand).
>> Most of the time this doesn't make a real difference since the same
>> thing would have been done elsewhere anyway, eg: by instcombine, but
>> there are a few places where this results in simplifications that we
>> were not doing before.
> Nice.  Should the related logic get ripped out of instcombine?  It is probably a little more general, but if it doesn't matter in practice, we should remove it.

when running std-compile-opts on gcc-as-one-big-file, this logic in
InstructionSimplify succeeds 171 times, while the corresponding logic in
InstCombine succeeds 4095 times.  As a point of comparison, InstCombine does
3536 constant folds on this testcase.  It is not surprising that instcombine
succeeds so much more often, as instsimplify is hugely constrained by the
requirement that it is only allowed to simplify to existing instructions, it is
not allowed to create any new instructions.  That said, if instsimplify was
allowed to modify instructions in place then I think for reassociation it would
catch everything.

Ciao, Duncan.

More information about the llvm-commits mailing list