[PATCH] D30890: Post-dom fix - connect virtual edges to last reverse-reachable BB

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 13:02:09 PDT 2017


dberlin added a comment.

In https://reviews.llvm.org/D30890#699658, @efriedma wrote:

> I see a couple problems with this:
>
> 1. There isn't any easy way for passes which use PostDominatorTree to walk the CFG including these fake edges.
> 2. For consistency, we would want other analysis and transform passes (DominatorTree/DominanceFrontier/LoopInfo/etc.) to reason about the CFG using the same fake edges as the PostDominatorTree; otherwise, you can't really rely on the results of the PostDominatorTree analysis.  I'm not exactly sure what the total impact would be, but it seems complicated at first glance.


Yes, besides the ongoing discussion of "maintain path invariant" vs "not maintain path invariant" for things, the connect to exit is easy because if there was a fake exit node, it would be the same and have the same predecessor edges, as the post-dom tree's virtual exit node.

For example, for IDF calculator, ignoring the path invariant it depends on for correctness (again, not gonna rehash the thread), you would need to add "j-edges" for these fake edges, such that they got walked at the same time the other predecessor edges did.

I'm not even sure where you store the fake edges, let alone modify the iterators to walk them.
It seems like at least right now, you'd have to hack up a bunch of stuff (IE store the edges with the PDT, and then audit everywhere that walked preds, ...)
That seems, as you said, complicated, even with the zip iterator/etc.

I'm actually a big fan of real edge structures and enabling fake edges vs what we do now in llvm, but that's also a huge change.


https://reviews.llvm.org/D30890





More information about the llvm-commits mailing list