[llvm-dev] [LLVM] New Dead Code Elimination

David Callahan via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 1 10:45:10 PDT 2016

I have a rewrite of the aggressive dead code elimination pass which handles control flow and allows may-be-infinite loops to be removed under optional flag. Chandler suggested rather than a large change a series of small changes and, while that may not get us to small changes easily, there has been no further commentary on the diff: https://reviews.llvm.org/D18762.  Given that, I will plan on proposing a series of diffs and would like to recruit some people who are interested in the change to help review those changes.

I expect to stage as follows:

1.     Rewrite base algorithm to introduce data structures needed to hold extra information (no functional change)

2.     Rewrite base algorithm to allow removing of control flow (under option, off by default). This variant will not be correct in the general case.

3.     Code to rewrite the control flow graph and remove dead basic blocks

4.     Identify Phi nodes with non-instruction reaching definitions and keep the associated source block live. Identify Phi nodes with multiple-live values from dead blocks

5.     Remove unreachable code discovered by post-order traversal to avoid.
 (code is functionally correct at this point)

6.     Use post-order traversal to identify loop bottoms. By default this will be kept live but include switch to allow loops to be removed.

7.     Improve handling of live values out of dead regions

Please respond if you are willing to help or have suggestions on staging or approach.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160801/15e3bab4/attachment-0001.html>

More information about the llvm-dev mailing list