[LLVMdev] A small pass to constant fold branch conditions in destination blocks

Duncan Sands baldrick at free.fr
Mon Feb 7 11:54:08 PST 2011


Here is a new and improved version that also does the following: if the
condition for a conditional branch has the form "A && B" then A, B and the
condition are all replaced with "true" in the true destination (similarly
for || conditions in the false destination).  Also, if the condition has
the form "X == Y" then X is replaced by Y everywhere in the true destination
(likewise if it is "X != Y" then X is replaced by Y everywhere in the false
destination).  Completely untested for correctness!

Scheduling this pass after -correlated-propagation results for example in
5759 lines of bitcode being removed from 403.gcc.

Ciao, Duncan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Prop.cpp
Type: text/x-c++src
Size: 5959 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110207/dd59aa72/attachment.cpp>


More information about the llvm-dev mailing list