summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-08-03 17:26:41 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-08-03 17:26:41 +0000
commit55ca964e944b610bfa09dd52490772b3d9f92fea (patch)
treef748d9e2304be9b0b442f37f7d606e336bcd39f0 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent910dde7ab2f725732222387af0d93f898afec42b (diff)
downloadbcm5719-llvm-55ca964e944b610bfa09dd52490772b3d9f92fea.tar.gz
bcm5719-llvm-55ca964e944b610bfa09dd52490772b3d9f92fea.zip
DI: Disallow uniquable DICompileUnits
Since r241097, `DIBuilder` has only created distinct `DICompileUnit`s. The backend is liable to start relying on that (if it hasn't already), so make uniquable `DICompileUnit`s illegal and automatically upgrade old bitcode. This is a nice cleanup, since we can remove an unnecessary `DenseSet` (and the associated uniquing info) from `LLVMContextImpl`. Almost all the testcases were updated with this script: git grep -e '= !DICompileUnit' -l -- test | grep -v test/Bitcode | xargs sed -i '' -e 's,= !DICompileUnit,= distinct !DICompileUnit,' I imagine something similar should work for out-of-tree testcases. llvm-svn: 243885
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 17bb64b1e1c..658c08f3646 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1872,15 +1872,16 @@ std::error_code BitcodeReader::parseMetadata() {
if (Record.size() < 14 || Record.size() > 15)
return error("Invalid record");
+ // Ignore Record[1], which indicates whether this compile unit is
+ // distinct. It's always distinct.
MDValueList.assignValue(
- GET_OR_DISTINCT(
- DICompileUnit, Record[0],
- (Context, Record[1], getMDOrNull(Record[2]),
- getMDString(Record[3]), Record[4], getMDString(Record[5]),
- Record[6], getMDString(Record[7]), Record[8],
- getMDOrNull(Record[9]), getMDOrNull(Record[10]),
- getMDOrNull(Record[11]), getMDOrNull(Record[12]),
- getMDOrNull(Record[13]), Record.size() == 14 ? 0 : Record[14])),
+ DICompileUnit::getDistinct(
+ Context, Record[1], getMDOrNull(Record[2]),
+ getMDString(Record[3]), Record[4], getMDString(Record[5]),
+ Record[6], getMDString(Record[7]), Record[8],
+ getMDOrNull(Record[9]), getMDOrNull(Record[10]),
+ getMDOrNull(Record[11]), getMDOrNull(Record[12]),
+ getMDOrNull(Record[13]), Record.size() == 14 ? 0 : Record[14]),
NextMDValueNo++);
break;
}
OpenPOWER on IntegriCloud