[cfe-dev] A question about PostDominatorTree::findNearestCommonDominator()

Peng Li peterlee at cs.utah.edu
Mon Dec 19 00:57:32 PST 2011


Hi There

I got a question about the 
PostDominatorTree::findNearestCommonDominator(), which
I used to find the the postdominator of two branches of a conditional 
instruction.

I encoded the following code into KLEE

     llvm::PostDominatorTree *pDominator = 
(llvm::PostDominatorTree*)llvm::createPostDomTree();
     BasicBlock *cpdBB = pDominator->findNearestCommonDominator(trueBB, 
falseBB);
     if (cpdBB) {
       std::cout << "The nearest common post-dominator for branch inst: 
" << std::endl;
       cpdBB->dump();
     }

Then I wrote a very simple test case to test it, the CFG is shown as 
follows:
                br
              /    \
    trueBB  falseBB
              \    /
            mergeBB

I expect to see the postdominator of trueBB and falseBB as mergeBB, but 
the function always
returns "falseBB" as post-dominator, did I do anything wrong during 
calling this function? My
llvm version is 2.8-release

Any hint is highly appreciated.

Thanks
Peng



More information about the cfe-dev mailing list