[LLVMdev] Post-dominance analysis for multiple-exit functions

Jonathan Ragan-Kelley jrk at csail.mit.edu
Tue Aug 25 17:35:14 PDT 2009


> The PostDominatorTree pass uses an artificial "exit node" to
> represent the post-dominator parent of all the exits.  Is this
> not what you're looking for?

You are correct.

This falls under the rubric of "am I missing something?" -- I was  
missing this:

   /// getRootNode - This returns the entry node for the CFG of the  
function.  If
   /// this tree represents the post-dominance relations for a  
function, however,
   /// this root may be a node with the block == NULL.  This is the  
case when
   /// there are multiple exit nodes from a particular function.   
Consumers of
   /// post-dominance information must be capable of dealing with this
   /// possibility.

and improperly assuming that I had to use the getRoots() interface for  
sane results from a post-dominator tree, because I was caught up with:

   /// getRoots -  Return the root blocks of the current CFG.  This  
may include
   /// multiple blocks if we are computing post dominators.  For forward
   /// dominators, this will always be a single block (the entry node).

The world is sane once again (and my control dependence analysis  
consistently works without requiring a prior MergeReturns pass).  
Thanks for indulging my oversight.



More information about the llvm-dev mailing list