[llvm-commits] [llvm] r77637 - in /llvm/trunk: lib/Bitcode/Writer/BitcodeWriter.cpp test/Feature/NamedMDNode2.ll
Devang Patel
dpatel at apple.com
Thu Jul 30 16:06:35 PDT 2009
Author: dpatel
Date: Thu Jul 30 18:06:35 2009
New Revision: 77637
URL: http://llvm.org/viewvc/llvm-project?rev=77637&view=rev
Log:
Do not use abbrev while writing NamedMDNode name.
Added:
llvm/trunk/test/Feature/NamedMDNode2.ll
Modified:
llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=77637&r1=77636&r2=77637&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Thu Jul 30 18:06:35 2009
@@ -495,7 +495,6 @@
const ValueEnumerator::ValueList &Vals = VE.getValues();
bool StartedMetadataBlock = false;
unsigned MDSAbbrev = 0;
- unsigned String8Abbrev = 0;
SmallVector<uint64_t, 64> Record;
for (unsigned i = 0, e = Vals.size(); i != e; ++i) {
@@ -530,18 +529,14 @@
if (!StartedMetadataBlock) {
Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);
StartedMetadataBlock = true;
- BitCodeAbbrev *Abbv = new BitCodeAbbrev();
- Abbv->Add(BitCodeAbbrevOp(bitc::CST_CODE_STRING));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
- Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));
- String8Abbrev = Stream.EmitAbbrev(Abbv);
}
// Write name.
- const char *StrBegin = NMD->getName().data();
- for (unsigned i = 0, e = NMD->getName().size(); i != e; ++i)
+ std::string Str = NMD->getNameStr();
+ const char *StrBegin = Str.c_str();
+ for (unsigned i = 0, e = Str.length(); i != e; ++i)
Record.push_back(StrBegin[i]);
- Stream.EmitRecord(bitc::METADATA_NAME, Record, String8Abbrev);
+ Stream.EmitRecord(bitc::METADATA_NAME, Record, 0/*TODO*/);
Record.clear();
// Write named metadata elements.
Added: llvm/trunk/test/Feature/NamedMDNode2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/NamedMDNode2.ll?rev=77637&view=auto
==============================================================================
--- llvm/trunk/test/Feature/NamedMDNode2.ll (added)
+++ llvm/trunk/test/Feature/NamedMDNode2.ll Thu Jul 30 18:06:35 2009
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s -f -o /dev/null
+; PR4654
+
+
+ at foo = constant i1 false
+!0 = metadata !{i1 false}
+!a = !{!0}
More information about the llvm-commits
mailing list