[LLVMdev] findNearestCommonDominator

Jochen Wilhelmy j.wilhelmy at arcor.de
Tue Mar 23 07:33:15 PDT 2010


Hi!

Is it possible to get findNearestCommonDominator working for
post dominator trees by changing llvm/include/llvm/Analysis/Dominators.h
starting at line 432:

   NodeT *findNearestCommonDominator(NodeT *A, NodeT *B) {

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

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;
}

     // If B dominates A then B is nearest common dominator.
     if (dominates(B, A))
       return B;

...

- Jochen



More information about the llvm-dev mailing list