[llvm-commits] [llvm] r123754 - in /llvm/trunk: lib/Analysis/InstructionSimplify.cpp test/Transforms/InstSimplify/2010-12-20-Distribute.ll

Chris Lattner clattner at apple.com
Tue Jan 18 09:19:36 PST 2011


On Jan 18, 2011, at 1:24 AM, Duncan Sands wrote:

> Author: baldrick
> Date: Tue Jan 18 03:24:58 2011
> New Revision: 123754
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=123754&view=rev
> Log:
> Simplify (X<<1)-X into X.  According to my auto-simplier this is the most common missed
> simplification in fully optimized code.  It occurs sporadically in the testsuite, and
> many times in 403.gcc: the final bitcode has 131 fewer subtractions after this change.
> The reason that the multiplies are not eliminated is the same reason that instcombine
> did not catch this: they are used by other instructions (instcombine catches this with
> a more general transform which in general is only profitable if the operands have only
> one use).

Cool.  Please add a comment to the code about why the explicit multiply is checked.  I still don't understand what the multiply having multiple uses has to do with it.  It seems that you can completely drop "match(Op0, m_Mul(m_Specific(Op1), m_ConstantInt<2>())) ||" since it should always be canonicalized to a shift.

-Chris



More information about the llvm-commits mailing list