summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-12-06 02:29:44 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-12-06 02:29:44 +0000
commit35303fd739705b9167fb2596175e5cb397921566 (patch)
tree78b922fc24c6d8a6c3ce848fe3914da5346dc9f6 /llvm/lib/Bitcode
parent6980404cfe7c18ee03369102843ddeaf21e64fcc (diff)
downloadbcm5719-llvm-35303fd739705b9167fb2596175e5cb397921566.tar.gz
bcm5719-llvm-35303fd739705b9167fb2596175e5cb397921566.zip
IR: Disallow function-local metadata attachments
Metadata attachments to instructions cannot be function-local. This is part of PR21532. llvm-svn: 223574
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 9f6d02f88db..72f823c2e3e 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2359,8 +2359,12 @@ std::error_code BitcodeReader::ParseMetadataAttachment() {
MDKindMap.find(Kind);
if (I == MDKindMap.end())
return Error(BitcodeError::InvalidID);
- Value *Node = MDValueList.getValueFwdRef(Record[i+1]);
- Inst->setMetadata(I->second, cast<MDNode>(Node));
+ MDNode *Node = cast<MDNode>(MDValueList.getValueFwdRef(Record[i+1]));
+ if (Node->isFunctionLocal())
+ // Drop the attachment. This used to be legal, but there's no
+ // upgrade path.
+ break;
+ Inst->setMetadata(I->second, Node);
if (I->second == LLVMContext::MD_tbaa)
InstsWithTBAATag.push_back(Inst);
}
OpenPOWER on IntegriCloud