[llvm-commits] [Review request] Have Correlated Value Propagation handle instruction operands.

Frits van Bommel fvbommel at gmail.com
Mon Feb 7 12:12:03 PST 2011


This patch teaches -correlated-propagation to check whether LVI knows
instruction operands to be constant, and if so to replace them. It
also adds a call to SimplifyInstruction afterwards so that the special
handling of some instructions (select, load, store) is no longer
needed.

This fixes the -correlated-propagation problem mentioned in comment 1
of PR 9004[1] and is an alternative implementation of "A small pass to
constant fold branch conditions in destination blocks"[2] which
integrates with the existing pass as Duncan suggested.
Since it leverages LVI, this also handles the 'if (x == 0) use(x)'
case mentioned in that post as well as the 'x > 10' followed by 'x >
5' case I mentioned in a follow-up (and doesn't need a domtree).

It passes 'make check-all'.


[1]: http://llvm.org/bugs/show_bug.cgi?id=9004
[2]: http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-February/037884.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: correlated-value-prop-operands.patch
Type: text/x-patch
Size: 6397 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110207/d45a717b/attachment.bin>


More information about the llvm-commits mailing list