[llvm-commits] [llvm] r90512 - /llvm/trunk/lib/VMCore/AsmWriter.cpp

Victor Hernandez vhernandez at apple.com
Fri Dec 4 11:00:47 PST 2009


I fixed this in r90572.

Victor

On Dec 4, 2009, at 9:39 AM, Devang Patel wrote:

> 
> On Dec 4, 2009, at 12:12 AM, Daniel Dunbar wrote:
> 
>> Hi Victor,
>> 
>> This is causing a crash in Clang (on its test suite), can you take a
>> look? The crash is here:
>>           if (isa<Instruction>(N->getElement(n)))
>> and N->getElement(n) is null. Perhaps this just needs a null check,
>> but I'm not sure if that is supposed to happen.
> 
> Yes, Null can happen and it is valid. In fact, most of the MDNodes describing location has null as the last element.
> -
> Devang
> 
>> 
>> - Daniel
>> 
>> On Thu, Dec 3, 2009 at 5:37 PM, Devang Patel <dpatel at apple.com> wrote:
>>> Hi Victor,
>>> On Dec 3, 2009, at 5:35 PM, Victor Hernandez wrote:
>>> 
>>>> Author: hernande
>>>> Date: Thu Dec  3 19:35:02 2009
>>>> New Revision: 90512
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=90512&view=rev
>>>> Log:
>>>> Teach AsmWriter to write inline (not via a global metadata slot)
>>>> metadata that contains an instruction
>>>> 
>>>> Modified:
>>>>   llvm/trunk/lib/VMCore/AsmWriter.cpp
>>>> 
>>>> Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=90512&r1=90511&r2=90512&view=diff
>>>> 
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> ======================================================================
>>>> --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
>>>> +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Thu Dec  3 19:35:02 2009
>>>> @@ -695,8 +695,13 @@
>>>>          !I->hasName())
>>>>        CreateFunctionSlot(I);
>>>>      for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
>>>> -        if (MDNode *N = dyn_cast_or_null<MDNode>(I->getOperand(i)))
>>>> +        if (MDNode *N = dyn_cast_or_null<MDNode>(I->getOperand(i))) {
>>>> +          // Create a metadata slot only if N contains no
>>>> instructions.
>>>> +          for (unsigned n = 0, e = N->getNumElements(); n != e; ++n)
>>>> +            if (isa<Instruction>(N->getElement(n)))
>>>> +              continue;
>>>>          CreateMetadataSlot(N);
>>>> +        }
>>>> 
>>>>      // Process metadata attached with this instruction.
>>>>      MDs.clear();
>>> 
>>> There are other places where CreateMetadataSlot() is used. Please move
>>> this check in side CreateMetadataSlot().
>>> -
>>> Devang
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20091204/531f893d/attachment.html>


More information about the llvm-commits mailing list