a problem when using postDominatorTree

Not yet. However I would love to find the reason.

Can you reproduce this with the development version of LLVM aka LLVM
trunk? Do you believe this bug is in the postdominator implementation or
in you code?
Can you extract a simplified test case with bugpoint?

Adding this to the bugtracker might be a good idea.

Tobias

I'll try the trunk, as well as check my code again. If indeed it's not fixed, I'll try to post a triggering case here.
Thanks for the advice~

Best,
--Wenbin

Wenbin Zhang wrote:

I'll try the trunk, as well as check my code again. If indeed it's not
fixed, I'll try to post a triggering case here.
Thanks for the advice~
  
Did you run the -mergereturn pass (it might also be called
UnifyExitNodes in the source code)? This is the pass that ensures that
each function has exactly one basic block that returns control to the
caller.

It's possible that PostDominator doesn't handle functions with multiple
exits (if someone knows whether it does or not, please let me know).

-- John T.

Wenbin Zhang wrote:

I'll try the trunk, as well as check my code again. If indeed it's not
fixed, I'll try to post a triggering case here.
Thanks for the advice~

Did you run the -mergereturn pass (it might also be called
UnifyExitNodes in the source code)? This is the pass that ensures that
each function has exactly one basic block that returns control to the
caller.

No I didn't. Maybe it's the case since the function I'm with has two exit().

I get the crash point now, the related codes are the following:

PostDominatorTree pdt;
pdt.runOnFunction(*F);
......
DomTreeNode *pdtNode = pdt.DT->getNode(fi)->getIDom();
BasicBlock *pdtBB = NULL;
if(pdtNode == NULL)
    continue;
pdtBB = pdtNode->getBlock();

And then when the value of "pdtNode->getBlock" in fact is NULL.
I supposed that there's a one-one mapping between each DomTreeNode and BasicBlock, thus I have no NULL-check on pdtBB.
But why does it happen?

It should. There are still limitations in terms of infinite loops that
are are not analyzed by the PostDominator analysis, but multiple exits
should be handled correctly. At least there is code try to support them.

Tobi