[llvm-commits] [llvm] r92783 - in /llvm/trunk: lib/AsmParser/LLParser.cpp lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/Bitcode/Writer/ValueEnumerator.cpp lib/VMCore/AsmWriter.cpp test/Feature/NamedMDNode.ll

Devang Patel dpatel at apple.com
Fri Jan 8 16:00:56 PST 2010


On Jan 8, 2010, at 11:51 AM, Chris Lattner wrote:

> On Jan 5, 2010, at 1:47 PM, Devang Patel wrote:
>> Author: dpatel
>> Date: Tue Jan  5 15:47:32 2010
>> New Revision: 92783
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=92783&view=rev
>> Log:
>> Allow null to be an element of NamedMDNode. e.g. !llvm.stuff = !{! 
>> 0, !1, null}
>
> looks good, one comment:
>
>> +++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Jan  5 15:47:32 2010
>> @@ -512,6 +512,12 @@
>>
>>  SmallVector<MDNode *, 8> Elts;
>>  do {
>> +    // Null is a special case since it is typeless.
>> +    if (EatIfPresent(lltok::kw_null)) {
>> +      Elts.push_back(0);
>> +      continue;
>> +    }
>
> The parser should not throw this away,

it does not. This loop is collecting elements. 0 is pushed as an  
element here.

> it should add a null pointer as an operand to the NamedMDNode.   
> Printing out IR and reading it back in should not change it.

   !foo = !{null}
works.

-
Devang




More information about the llvm-commits mailing list