summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-08 22:38:29 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-08 22:38:29 +0000
commit090a19bd3cab8b4247bb41eecf20e9f0f211332b (patch)
tree3c7d1b2041a30c42072457ae7adc70ef5d873bd3 /llvm/lib/Bitcode/Reader
parent22ffa9b291e17a45ddc553817bbfee9d575e5600 (diff)
downloadbcm5719-llvm-090a19bd3cab8b4247bb41eecf20e9f0f211332b.tar.gz
bcm5719-llvm-090a19bd3cab8b4247bb41eecf20e9f0f211332b.zip
IR: Add 'distinct' MDNodes to bitcode and assembly
Propagate whether `MDNode`s are 'distinct' through the other types of IR (assembly and bitcode). This adds the `distinct` keyword to assembly. Currently, no one actually calls `MDNode::getDistinct()`, so these nodes only get created for: - self-references, which are never uniqued, and - nodes whose operands are replaced that hit a uniquing collision. The concept of distinct nodes is still not quite first-class, since distinct-ness doesn't yet survive across `MapMetadata()`. Part of PR22111. llvm-svn: 225474
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 7c7eebde1df..1792f8b8dd4 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1106,6 +1106,7 @@ std::error_code BitcodeReader::ParseMetadata() {
// Read a record.
Record.clear();
unsigned Code = Stream.readRecord(Entry.ID, Record);
+ bool IsDistinct = false;
switch (Code) {
default: // Default behavior: ignore.
break;
@@ -1196,12 +1197,17 @@ std::error_code BitcodeReader::ParseMetadata() {
NextMDValueNo++);
break;
}
+ case bitc::METADATA_DISTINCT_NODE:
+ IsDistinct = true;
+ // fallthrough...
case bitc::METADATA_NODE: {
SmallVector<Metadata *, 8> Elts;
Elts.reserve(Record.size());
for (unsigned ID : Record)
Elts.push_back(ID ? MDValueList.getValueFwdRef(ID - 1) : nullptr);
- MDValueList.AssignValue(MDNode::get(Context, Elts), NextMDValueNo++);
+ MDValueList.AssignValue(IsDistinct ? MDNode::getDistinct(Context, Elts)
+ : MDNode::get(Context, Elts),
+ NextMDValueNo++);
break;
}
case bitc::METADATA_STRING: {
OpenPOWER on IntegriCloud