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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user