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

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 17 13:54:46 PST 2016


mehdi_amini added inline comments.


================
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
----------------
david2050 wrote:
> 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.
My question was about another invariant at this stage:

```
A
| \
B C
| |
D E
```

If B and C are dead, but A, D and E are live. 
A's terminator branch to either B or C, which are both dead. However B and C aren't part of the same dead region.
You're operating here under the assumption that A's terminator has be marked as live somehow, right?


https://reviews.llvm.org/D24918





More information about the llvm-commits mailing list