[PATCH] D24918: [ADCE] Add code to remove dead branches

David Callahan via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 17 12:14:35 PST 2016


david2050 marked 10 inline comments as done.
david2050 added inline comments.


================
Comment at: lib/Transforms/Scalar/ADCE.cpp:621
+    // Scan for dead successors. A live successor will be the
+    // unique post-dominator for all of the blocks in this region.
+    for (auto SuccBB : successors(BB)) {
----------------
mehdi_amini wrote:
> How do we get this invariant that a region has a single live PDOM?
> (If you can point me to the relevant code)
I will add a comment:
    // (A block with a dead branch which reaches a live block that
    //  is not a post-dominator would be a control dependence source
    //  and hence its branch must be live)



================
Comment at: lib/Transforms/Scalar/ADCE.cpp:665
+      // This is a live block but the terminator is not live so all
+      // control reaches the LivePdom, so we make the terminator
+      // an unconditional branch to that destination (B29 in the example
----------------
mehdi_amini wrote:
> To make sure I understand correctly: if the terminator was a conditional branch with each target BB in different dead region, then this terminator shouldn't be marked as dead?
This is a live block which has whose terminator is dead the implication is that all paths from this branch must reach LivePDOM (directly or through blocks with dead branches). We replace this branch with an unconditional branch.


https://reviews.llvm.org/D24918





More information about the llvm-commits mailing list