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

David Callahan via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 1 08:40:45 PDT 2016


david2050 added inline comments.


> dberlin wrote in ADCE.cpp:610
> Is the above really necessary?
> 
> The standard way to do this, AFAIK, is to mark the useful block set while doing marking, and then just walking up the PDT to find the nearest block marked useful for each dead branch.
> Replace all uses of the bb with that block using RAUW.
> This should update phi nodes, since I believe the blocks in phi nodes are still considered uses.

I don't understand this approach. Given a live branch  (x,y) where y is dead and  z is the live post-dominator of y, we can't just replace uses of 'y' because the 'y' may not be directly referenced in phi nodes in 'z' which only will old references to its predecessors. Also, 'y' could have multiple branches into it which are dead.

https://reviews.llvm.org/D24918





More information about the llvm-commits mailing list