diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-03-25 00:56:13 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-03-25 00:56:13 +0000 |
commit | efe16c8eb4fa5450fba4a1465e01620ba6c2c402 (patch) | |
tree | b39831ecf389341074bbc0917784200f85816530 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | f72d5b608dacc1d4184d848cde3d8ca480df43cc (diff) | |
download | bcm5719-llvm-efe16c8eb4fa5450fba4a1465e01620ba6c2c402.tar.gz bcm5719-llvm-efe16c8eb4fa5450fba4a1465e01620ba6c2c402.zip |
IR: Stop upgrading !llvm.loop attachments via MDString
Remove logic to upgrade !llvm.loop by changing the MDString tag
directly. This old logic would check (and change) arbitrary strings
that had nothing to do with loop metadata. Instead, check !llvm.loop
attachments directly, and change which strings get attached.
Rather than updating the assembly-based upgrade, drop it entirely. It
has been quite a while since we supported upgrading textual IR.
llvm-svn: 264373
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index dcaaa7d2975..99bd0b1fbd7 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -166,6 +166,8 @@ class BitcodeReader : public GVMaterializer { SmallVector<Instruction*, 64> InstsWithTBAATag; + bool HasSeenOldLoopTags = false; + /// The set of attributes by index. Index zero in the file is for null, and /// is thus not represented here. As such all indices are off by one. std::vector<AttributeSet> MAttributes; @@ -2385,7 +2387,10 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) { } case bitc::METADATA_STRING: { std::string String(Record.begin(), Record.end()); - llvm::UpgradeMDStringConstant(String); + + // Test for upgrading !llvm.loop. + HasSeenOldLoopTags |= mayBeOldLoopAttachmentTag(String); + Metadata *MD = MDString::get(Context, String); MetadataList.assignValue(MD, NextMetadataNo++); break; @@ -3956,9 +3961,15 @@ std::error_code BitcodeReader::parseMetadataAttachment(Function &F) { MDNode *MD = dyn_cast_or_null<MDNode>(Node); if (!MD) return error("Invalid metadata attachment"); + + if (HasSeenOldLoopTags && I->second == LLVMContext::MD_loop) + MD = upgradeInstructionLoopAttachment(*MD); + Inst->setMetadata(I->second, MD); - if (I->second == LLVMContext::MD_tbaa) + if (I->second == LLVMContext::MD_tbaa) { InstsWithTBAATag.push_back(Inst); + continue; + } } break; } |