[LLVMdev] findNearestCommonDominator

Jochen Wilhelmy j.wilhelmy at arcor.de
Sun Mar 7 13:33:11 PST 2010


Hi!

I have seen that findNearestCommonDominator has been added
to class PostDominatorTree, maybe on my request.

Now there is the following problem:
in class DominatorTreeBase  there is an assert in findNearestCommonDominator
that asserts if the tree is not a PostDominator tree:

   assert (!this->isPostDominator()
            && "This is not implemented for post dominators");
    assert (A->getParent() == B->getParent()
            && "Two blocks are not in same function");

    // If either A or B is a entry block then it is nearest common 
dominator.
    NodeT &Entry  = A->getParent()->front();
    if (A == &Entry || B == &Entry)
      return &Entry;




When commenting out the assert it seems to work. Perhaps it has to be 
changed
that the check for entry block (which seems to be an optimization)
is only done for DominatorTree:

if (!this->isPostDominator())
{
  // If either A or B is a entry block then it is nearest common dominator.
    NodeT &Entry  = A->getParent()->front();
    if (A == &Entry || B == &Entry)
      return &Entry;
}


I think an expert on this topic has to look at this.

-Jochen




More information about the llvm-dev mailing list