Expand description
A post-dominator tree for a single function.
The post-dominator tree is the dual of the DominatorTree: it answers
whether every path from a block to a function exit (a return, trap,
etc.) must pass through some other block.
It is computed by reusing the ordinary dominator-tree machinery on a modified version of the control-flow graph:
-
Add a virtual sink node.
-
Every block whose terminator does not branch anywhere (
return,return_call,trap, etc.) is given an edge to the virtual sink. -
Reverse every edge in the graph, so
a -> bbecomesb -> a. -
Compute the dominator tree of this reversed graph, rooted at the virtual sink.
Note that we don’t actually reify this modified version of the control-flow
graph, we instead use the ReverseGraph implementation of the
DomTreeGraph trait.
Structs§
- Post
Dominator Tree - The post-dominator tree for a single function.