[llvm] [DebugInfo] Add DILayerLoc/DILayerLocList and DILocation irlayers operand (PR #215666)
Alexander Yermolovich via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 16:51:56 PDT 2026
================
@@ -1482,15 +1486,47 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
Metadata *Scope = getMD(Record[3]);
Metadata *InlinedAt = getMDOrNull(Record[4]);
bool ImplicitCode = Record.size() >= 6 && Record[5];
- uint64_t AtomGroup = Record.size() == 8 ? Record[6] : 0;
- uint8_t AtomRank = Record.size() == 8 ? Record[7] : 0;
+ uint64_t AtomGroup = Record.size() >= 8 ? Record[6] : 0;
+ uint8_t AtomRank = Record.size() >= 8 ? Record[7] : 0;
+ Metadata *IRLayers = Record.size() >= 9 ? getMDOrNull(Record[8]) : nullptr;
MetadataList.assignValue(
- GET_OR_DISTINCT(DILocation, (Context, Line, Column, Scope, InlinedAt,
- ImplicitCode, AtomGroup, AtomRank)),
+ GET_OR_DISTINCT(DILocation,
+ (Context, Line, Column, Scope, InlinedAt, ImplicitCode,
+ AtomGroup, AtomRank, IRLayers)),
NextMetadataNo);
NextMetadataNo++;
break;
}
+ case bitc::METADATA_LAYERLOC: {
+ if (Record.size() != 5)
+ return error("Invalid record");
+
+ IsDistinct = Record[0];
+ unsigned Line = Record[1];
+ unsigned Column = Record[2];
+ Metadata *File = getMD(Record[3]);
+ // Read the kind opaquely and let the verifier report a bad type, as the
+ // other DI readers do: an unchecked cast would assert on malformed bitcode.
+ MDString *Kind = dyn_cast_if_present<MDString>(getMD(Record[4]));
----------------
ayermolo wrote:
Not in this case. On writer side I am using:
Record.push_back(VE.getMetadataID(N->getRawKind()));
Which does -1 on write side.
Because Kind is not an optional parameter.
On loader side the getMDString is basically a wrapper aound getMDorNull which does -1 bias. Which not be correct in this case.
https://github.com/llvm/llvm-project/pull/215666
More information about the llvm-commits
mailing list