[LLVMdev] DSA getNodeForValue() Returning NULL Sometimes

Dan Gohman gohman at apple.com
Mon Aug 10 10:07:42 PDT 2009


On Aug 7, 2009, at 4:59 PM, Patrick Alexander Simmons wrote:


> Patrick Alexander Simmons wrote:
>
>> John Criswell wrote:
>>
>>
>>
>>> You can sometimes get NULL DSNodes if a previously-run transform  
>>> pass
>>>
>>> adds pointers to the program but doesn't update DSA while claiming  
>>> to
>>>
>>> preserve it.  The pool allocation pass, for example, does this: it
>>>
>>> claims to preserve the DSA results (when used for SAFECode) but  
>>> doesn't
>>>
>>> properly update the DSGraph when it adds pool handles.  Therefore,  
>>> if
>>>
>>> you try to get the DSNode of a Pool Handle pointer, you get a NULL  
>>> DSNode.
>>>
>>>
>>>
>>> I don't know if this is what you're seeing, but it's a potential  
>>> reason.
>>>
>>>
>>>
>>> -- John T.
>>>
>>>
>>>
>>>
>>>
>> No, that's not it.  This is happening before pool allocation has been
>>
>> run.  It sounds like this is something that shouldn't be happening;  
>> I'll
>>
>> look into why it is.
>>
>>
>>
>> --Patrick
>>
>> _______________________________________________
>>
>> LLVM Developers mailing list
>>
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>>
> I seem to recall someone telling me that DSA was intended to be run
> after certain optimizations, and I was using it on completely
> unoptimized code.  The problem goes away when I run the code through  
> opt
> with "-std-compile-opts" first because the corresponding loads and
> stores go away, so maybe that's it.

I'm not familiar with LLVM's DSA infrastructure, but in general, LLVM
passes are expected to behave correctly regardless of what other
optimization passes have been run. If you're seeing things return
NULL that shouldn't, then you're probably seeing a bug, even if
-std-compile-opts fixes it.

On the other hand, there's no expectation that passes will always be
profitable. For example, IR generated from a C front-end is virtually
unusable until at least mem2reg is run.

Dan




More information about the llvm-dev mailing list