[LLVMdev] a problem when using postDominatorTree

Wenbin Zhang zhangwen at cse.ohio-state.edu
Thu Aug 5 09:06:12 PDT 2010


----- Original Message ----- 
From: "John Criswell" <criswell at uiuc.edu>
To: "Wenbin Zhang" <zhangwen at cse.ohio-state.edu>
Cc: "Tobias Grosser" <grosser at fim.uni-passau.de>; <llvmdev at cs.uiuc.edu>
Sent: Thursday, August 05, 2010 12:00 PM
Subject: Re: [LLVMdev] a problem when using postDominatorTree


> 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'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.
>
>> Best,
>> --Wenbin
>>
>>
>> ----- Original Message ----- 
>> From: "Tobias Grosser" <grosser at fim.uni-passau.de>
>> To: "Wenbin Zhang" <zhangwen at cse.ohio-state.edu>
>> Cc: <llvmdev at cs.uiuc.edu>
>> Sent: Thursday, August 05, 2010 3:07 AM
>> Subject: Re: [LLVMdev] a problem when using postDominatorTree
>>
>>
>>
>>> On 08/05/2010 06:46 AM, Wenbin Zhang wrote:
>>>
>>>> Hi all,
>>>> I'm using postDominatorTree to do some program analysis. My code works
>>>> well for small tests, but when I run it on real applications, the
>>>> following error occurs:
>>>> /Inorder PostDominator Tree: DFSNumbers invalid: 0 slow queries.
>>>> [1] <<exit node>> {0,21}
>>>> [2] %bb1 {1,2}
>>>> [2] %bb {3,4}
>>>> [2] %entry {5,6}
>>>> [2] %bb8 {7,20}
>>>> [3] %bb7 {8,9}
>>>> [3] %bb2 {10,11}
>>>> [3] %bb6 {12,13}
>>>> [3] %bb5 {14,19}
>>>> [4] %bb4 {15,16}
>>>> [4] %bb3 {17,18}
>>>> 0 opt 0x085643e8
>>>> Stack dump:
>>>> 0. Program arguments: opt
>>>> -load=/home/a_i/llvm/llvm-2.7/Release/lib/ConsDumper.so -consdumper -f
>>>> -o pbzip2_2s.bc pbzip2.bc -debug
>>>> 1. Running pass 'dump constraints' on module 'pbzip2.bc'.
>>>> Segmentation fault/
>>>> I have no hint about this. Does anyone know about the reason?
>>>>
>>> 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
>>>
>>>
>>
>>
> 




More information about the llvm-dev mailing list