Skip to content

Commit 75819ae

Browse files
committed
[PR27284] Reverse the ownership between DICompileUnit and DISubprogram.
Currently each Function points to a DISubprogram and DISubprogram has a scope field. For member functions the scope is a DICompositeType. DIScopes point to the DICompileUnit to facilitate type uniquing. Distinct DISubprograms (with isDefinition: true) are not part of the type hierarchy and cannot be uniqued. This change removes the subprograms list from DICompileUnit and instead adds a pointer to the owning compile unit to distinct DISubprograms. This would make it easy for ThinLTO to strip unneeded DISubprograms and their transitively referenced debug info. Motivation ---------- Materializing DISubprograms is currently the most expensive operation when doing a ThinLTO build of clang. We want the DISubprogram to be stored in a separate Bitcode block (or the same block as the function body) so we can avoid having to expensively deserialize all DISubprograms together with the global metadata. If a function has been inlined into another subprogram we need to store a reference the block containing the inlined subprogram. Attached to https://llvm.org/bugs/show_bug.cgi?id=27284 is a python script that updates LLVM IR testcases to the new format. http://reviews.llvm.org/D19034 <rdar://problem/25256815> llvm-svn: 266446
1 parent e76bda5 commit 75819ae

File tree

540 files changed

+1766
-2300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

540 files changed

+1766
-2300
lines changed

llvm/include/llvm/IR/DIBuilder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,9 @@ namespace llvm {
403403
uint64_t AlignInBits = 0, unsigned Flags = DINode::FlagFwdDecl,
404404
StringRef UniqueIdentifier = "");
405405

406-
/// Retain DIType* in a module even if it is not referenced
406+
/// Retain DIScope* in a module even if it is not referenced
407407
/// through debug info anchors.
408-
void retainType(DIType *T);
408+
void retainType(DIScope *T);
409409

410410
/// Create unspecified parameter type
411411
/// for a subroutine type.

llvm/include/llvm/IR/DebugInfoMetadata.h

Lines changed: 50 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -959,25 +959,21 @@ class DICompileUnit : public DIScope {
959959
StringRef Producer, bool IsOptimized, StringRef Flags,
960960
unsigned RuntimeVersion, StringRef SplitDebugFilename,
961961
unsigned EmissionKind, DICompositeTypeArray EnumTypes,
962-
DITypeArray RetainedTypes, DISubprogramArray Subprograms,
963-
DIGlobalVariableArray GlobalVariables,
962+
DIScopeArray RetainedTypes, DIGlobalVariableArray GlobalVariables,
964963
DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
965964
uint64_t DWOId, StorageType Storage, bool ShouldCreate = true) {
966-
return getImpl(Context, SourceLanguage, File,
967-
getCanonicalMDString(Context, Producer), IsOptimized,
968-
getCanonicalMDString(Context, Flags), RuntimeVersion,
969-
getCanonicalMDString(Context, SplitDebugFilename),
970-
EmissionKind, EnumTypes.get(), RetainedTypes.get(),
971-
Subprograms.get(), GlobalVariables.get(),
972-
ImportedEntities.get(), Macros.get(), DWOId, Storage,
973-
ShouldCreate);
965+
return getImpl(
966+
Context, SourceLanguage, File, getCanonicalMDString(Context, Producer),
967+
IsOptimized, getCanonicalMDString(Context, Flags), RuntimeVersion,
968+
getCanonicalMDString(Context, SplitDebugFilename), EmissionKind,
969+
EnumTypes.get(), RetainedTypes.get(), GlobalVariables.get(),
970+
ImportedEntities.get(), Macros.get(), DWOId, Storage, ShouldCreate);
974971
}
975972
static DICompileUnit *
976973
getImpl(LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
977974
MDString *Producer, bool IsOptimized, MDString *Flags,
978975
unsigned RuntimeVersion, MDString *SplitDebugFilename,
979-
unsigned EmissionKind, Metadata *EnumTypes,
980-
Metadata *RetainedTypes, Metadata *Subprograms,
976+
unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
981977
Metadata *GlobalVariables, Metadata *ImportedEntities,
982978
Metadata *Macros, uint64_t DWOId, StorageType Storage,
983979
bool ShouldCreate = true);
@@ -986,7 +982,7 @@ class DICompileUnit : public DIScope {
986982
return getTemporary(
987983
getContext(), getSourceLanguage(), getFile(), getProducer(),
988984
isOptimized(), getFlags(), getRuntimeVersion(), getSplitDebugFilename(),
989-
getEmissionKind(), getEnumTypes(), getRetainedTypes(), getSubprograms(),
985+
getEmissionKind(), getEnumTypes(), getRetainedTypes(),
990986
getGlobalVariables(), getImportedEntities(), getMacros(), DWOId);
991987
}
992988

@@ -999,23 +995,22 @@ class DICompileUnit : public DIScope {
999995
(unsigned SourceLanguage, DIFile *File, StringRef Producer,
1000996
bool IsOptimized, StringRef Flags, unsigned RuntimeVersion,
1001997
StringRef SplitDebugFilename, DebugEmissionKind EmissionKind,
1002-
DICompositeTypeArray EnumTypes, DITypeArray RetainedTypes,
1003-
DISubprogramArray Subprograms, DIGlobalVariableArray GlobalVariables,
998+
DICompositeTypeArray EnumTypes, DIScopeArray RetainedTypes,
999+
DIGlobalVariableArray GlobalVariables,
10041000
DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
10051001
uint64_t DWOId),
10061002
(SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
1007-
SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes, Subprograms,
1003+
SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
10081004
GlobalVariables, ImportedEntities, Macros, DWOId))
10091005
DEFINE_MDNODE_GET_DISTINCT_TEMPORARY(
10101006
DICompileUnit,
10111007
(unsigned SourceLanguage, Metadata *File, MDString *Producer,
10121008
bool IsOptimized, MDString *Flags, unsigned RuntimeVersion,
10131009
MDString *SplitDebugFilename, unsigned EmissionKind, Metadata *EnumTypes,
1014-
Metadata *RetainedTypes, Metadata *Subprograms,
1015-
Metadata *GlobalVariables, Metadata *ImportedEntities, Metadata *Macros,
1016-
uint64_t DWOId),
1010+
Metadata *RetainedTypes, Metadata *GlobalVariables,
1011+
Metadata *ImportedEntities, Metadata *Macros, uint64_t DWOId),
10171012
(SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
1018-
SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes, Subprograms,
1013+
SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
10191014
GlobalVariables, ImportedEntities, Macros, DWOId))
10201015

10211016
TempDICompileUnit clone() const { return cloneImpl(); }
@@ -1032,12 +1027,9 @@ class DICompileUnit : public DIScope {
10321027
DICompositeTypeArray getEnumTypes() const {
10331028
return cast_or_null<MDTuple>(getRawEnumTypes());
10341029
}
1035-
DITypeArray getRetainedTypes() const {
1030+
DIScopeArray getRetainedTypes() const {
10361031
return cast_or_null<MDTuple>(getRawRetainedTypes());
10371032
}
1038-
DISubprogramArray getSubprograms() const {
1039-
return cast_or_null<MDTuple>(getRawSubprograms());
1040-
}
10411033
DIGlobalVariableArray getGlobalVariables() const {
10421034
return cast_or_null<MDTuple>(getRawGlobalVariables());
10431035
}
@@ -1057,10 +1049,9 @@ class DICompileUnit : public DIScope {
10571049
}
10581050
Metadata *getRawEnumTypes() const { return getOperand(4); }
10591051
Metadata *getRawRetainedTypes() const { return getOperand(5); }
1060-
Metadata *getRawSubprograms() const { return getOperand(6); }
1061-
Metadata *getRawGlobalVariables() const { return getOperand(7); }
1062-
Metadata *getRawImportedEntities() const { return getOperand(8); }
1063-
Metadata *getRawMacros() const { return getOperand(9); }
1052+
Metadata *getRawGlobalVariables() const { return getOperand(6); }
1053+
Metadata *getRawImportedEntities() const { return getOperand(7); }
1054+
Metadata *getRawMacros() const { return getOperand(8); }
10641055

10651056
/// \brief Replace arrays.
10661057
///
@@ -1074,16 +1065,13 @@ class DICompileUnit : public DIScope {
10741065
void replaceRetainedTypes(DITypeArray N) {
10751066
replaceOperandWith(5, N.get());
10761067
}
1077-
void replaceSubprograms(DISubprogramArray N) {
1078-
replaceOperandWith(6, N.get());
1079-
}
10801068
void replaceGlobalVariables(DIGlobalVariableArray N) {
1081-
replaceOperandWith(7, N.get());
1069+
replaceOperandWith(6, N.get());
10821070
}
10831071
void replaceImportedEntities(DIImportedEntityArray N) {
1084-
replaceOperandWith(8, N.get());
1072+
replaceOperandWith(7, N.get());
10851073
}
1086-
void replaceMacros(DIMacroNodeArray N) { replaceOperandWith(9, N.get()); }
1074+
void replaceMacros(DIMacroNodeArray N) { replaceOperandWith(8, N.get()); }
10871075
/// @}
10881076

10891077
static bool classof(const Metadata *MD) {
@@ -1266,13 +1254,13 @@ class DISubprogram : public DILocalScope {
12661254
DISubroutineType *Type, bool IsLocalToUnit, bool IsDefinition,
12671255
unsigned ScopeLine, DITypeRef ContainingType, unsigned Virtuality,
12681256
unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
1269-
DITemplateParameterArray TemplateParams, DISubprogram *Declaration,
1270-
DILocalVariableArray Variables, StorageType Storage,
1271-
bool ShouldCreate = true) {
1257+
DICompileUnit *Unit, DITemplateParameterArray TemplateParams,
1258+
DISubprogram *Declaration, DILocalVariableArray Variables,
1259+
StorageType Storage, bool ShouldCreate = true) {
12721260
return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
12731261
getCanonicalMDString(Context, LinkageName), File, Line, Type,
12741262
IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,
1275-
Virtuality, VirtualIndex, Flags, IsOptimized,
1263+
Virtuality, VirtualIndex, Flags, IsOptimized, Unit,
12761264
TemplateParams.get(), Declaration, Variables.get(), Storage,
12771265
ShouldCreate);
12781266
}
@@ -1281,16 +1269,17 @@ class DISubprogram : public DILocalScope {
12811269
MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
12821270
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
12831271
Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
1284-
unsigned Flags, bool IsOptimized, Metadata *TemplateParams,
1285-
Metadata *Declaration, Metadata *Variables, StorageType Storage,
1286-
bool ShouldCreate = true);
1272+
unsigned Flags, bool IsOptimized, Metadata *Unit,
1273+
Metadata *TemplateParams, Metadata *Declaration, Metadata *Variables,
1274+
StorageType Storage, bool ShouldCreate = true);
12871275

12881276
TempDISubprogram cloneImpl() const {
1289-
return getTemporary(
1290-
getContext(), getScope(), getName(), getLinkageName(), getFile(),
1291-
getLine(), getType(), isLocalToUnit(), isDefinition(), getScopeLine(),
1292-
getContainingType(), getVirtuality(), getVirtualIndex(), getFlags(),
1293-
isOptimized(), getTemplateParams(), getDeclaration(), getVariables());
1277+
return getTemporary(getContext(), getScope(), getName(), getLinkageName(),
1278+
getFile(), getLine(), getType(), isLocalToUnit(),
1279+
isDefinition(), getScopeLine(), getContainingType(),
1280+
getVirtuality(), getVirtualIndex(), getFlags(),
1281+
isOptimized(), getUnit(), getTemplateParams(),
1282+
getDeclaration(), getVariables());
12941283
}
12951284

12961285
public:
@@ -1300,24 +1289,25 @@ class DISubprogram : public DILocalScope {
13001289
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
13011290
DITypeRef ContainingType, unsigned Virtuality,
13021291
unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
1292+
DICompileUnit *Unit,
13031293
DITemplateParameterArray TemplateParams = nullptr,
13041294
DISubprogram *Declaration = nullptr,
13051295
DILocalVariableArray Variables = nullptr),
13061296
(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
13071297
IsDefinition, ScopeLine, ContainingType, Virtuality,
1308-
VirtualIndex, Flags, IsOptimized, TemplateParams,
1298+
VirtualIndex, Flags, IsOptimized, Unit, TemplateParams,
13091299
Declaration, Variables))
13101300
DEFINE_MDNODE_GET(
13111301
DISubprogram,
13121302
(Metadata * Scope, MDString *Name, MDString *LinkageName, Metadata *File,
13131303
unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
13141304
unsigned ScopeLine, Metadata *ContainingType, unsigned Virtuality,
13151305
unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
1316-
Metadata *TemplateParams = nullptr, Metadata *Declaration = nullptr,
1317-
Metadata *Variables = nullptr),
1306+
Metadata *Unit, Metadata *TemplateParams = nullptr,
1307+
Metadata *Declaration = nullptr, Metadata *Variables = nullptr),
13181308
(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,
13191309
ScopeLine, ContainingType, Virtuality, VirtualIndex, Flags, IsOptimized,
1320-
TemplateParams, Declaration, Variables))
1310+
Unit, TemplateParams, Declaration, Variables))
13211311

13221312
TempDISubprogram clone() const { return cloneImpl(); }
13231313

@@ -1376,6 +1366,12 @@ class DISubprogram : public DILocalScope {
13761366
return DITypeRef(getRawContainingType());
13771367
}
13781368

1369+
DICompileUnit *getUnit() const {
1370+
return cast_or_null<DICompileUnit>(getRawUnit());
1371+
}
1372+
void replaceUnit(DICompileUnit *CU) {
1373+
replaceOperandWith(7, CU);
1374+
}
13791375
DITemplateParameterArray getTemplateParams() const {
13801376
return cast_or_null<MDTuple>(getRawTemplateParams());
13811377
}
@@ -1389,9 +1385,10 @@ class DISubprogram : public DILocalScope {
13891385
Metadata *getRawScope() const { return getOperand(1); }
13901386
Metadata *getRawType() const { return getOperand(5); }
13911387
Metadata *getRawContainingType() const { return getOperand(6); }
1392-
Metadata *getRawTemplateParams() const { return getOperand(7); }
1393-
Metadata *getRawDeclaration() const { return getOperand(8); }
1394-
Metadata *getRawVariables() const { return getOperand(9); }
1388+
Metadata *getRawUnit() const { return getOperand(7); }
1389+
Metadata *getRawTemplateParams() const { return getOperand(8); }
1390+
Metadata *getRawDeclaration() const { return getOperand(9); }
1391+
Metadata *getRawVariables() const { return getOperand(10); }
13951392

13961393
/// \brief Check if this subprogram describes the given function.
13971394
///

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3875,8 +3875,7 @@ bool LLParser::ParseDIFile(MDNode *&Result, bool IsDistinct) {
38753875
/// ::= !DICompileUnit(language: DW_LANG_C99, file: !0, producer: "clang",
38763876
/// isOptimized: true, flags: "-O2", runtimeVersion: 1,
38773877
/// splitDebugFilename: "abc.debug",
3878-
/// emissionKind: FullDebug,
3879-
/// enums: !1, retainedTypes: !2, subprograms: !3,
3878+
/// emissionKind: FullDebug, enums: !1, retainedTypes: !2,
38803879
/// globals: !4, imports: !5, macros: !6, dwoId: 0x0abcd)
38813880
bool LLParser::ParseDICompileUnit(MDNode *&Result, bool IsDistinct) {
38823881
if (!IsDistinct)
@@ -3893,7 +3892,6 @@ bool LLParser::ParseDICompileUnit(MDNode *&Result, bool IsDistinct) {
38933892
OPTIONAL(emissionKind, EmissionKindField, ); \
38943893
OPTIONAL(enums, MDField, ); \
38953894
OPTIONAL(retainedTypes, MDField, ); \
3896-
OPTIONAL(subprograms, MDField, ); \
38973895
OPTIONAL(globals, MDField, ); \
38983896
OPTIONAL(imports, MDField, ); \
38993897
OPTIONAL(macros, MDField, ); \
@@ -3904,8 +3902,7 @@ bool LLParser::ParseDICompileUnit(MDNode *&Result, bool IsDistinct) {
39043902
Result = DICompileUnit::getDistinct(
39053903
Context, language.Val, file.Val, producer.Val, isOptimized.Val, flags.Val,
39063904
runtimeVersion.Val, splitDebugFilename.Val, emissionKind.Val, enums.Val,
3907-
retainedTypes.Val, subprograms.Val, globals.Val, imports.Val, macros.Val,
3908-
dwoId.Val);
3905+
retainedTypes.Val, globals.Val, imports.Val, macros.Val, dwoId.Val);
39093906
return false;
39103907
}
39113908

@@ -3934,6 +3931,7 @@ bool LLParser::ParseDISubprogram(MDNode *&Result, bool IsDistinct) {
39343931
OPTIONAL(virtualIndex, MDUnsignedField, (0, UINT32_MAX)); \
39353932
OPTIONAL(flags, DIFlagField, ); \
39363933
OPTIONAL(isOptimized, MDBoolField, ); \
3934+
OPTIONAL(unit, MDField, ); \
39373935
OPTIONAL(templateParams, MDField, ); \
39383936
OPTIONAL(declaration, MDField, ); \
39393937
OPTIONAL(variables, MDField, );
@@ -3946,11 +3944,11 @@ bool LLParser::ParseDISubprogram(MDNode *&Result, bool IsDistinct) {
39463944
"missing 'distinct', required for !DISubprogram when 'isDefinition'");
39473945

39483946
Result = GET_OR_DISTINCT(
3949-
DISubprogram,
3950-
(Context, scope.Val, name.Val, linkageName.Val, file.Val, line.Val,
3951-
type.Val, isLocal.Val, isDefinition.Val, scopeLine.Val,
3952-
containingType.Val, virtuality.Val, virtualIndex.Val, flags.Val,
3953-
isOptimized.Val, templateParams.Val, declaration.Val, variables.Val));
3947+
DISubprogram, (Context, scope.Val, name.Val, linkageName.Val, file.Val,
3948+
line.Val, type.Val, isLocal.Val, isDefinition.Val,
3949+
scopeLine.Val, containingType.Val, virtuality.Val,
3950+
virtualIndex.Val, flags.Val, isOptimized.Val, unit.Val,
3951+
templateParams.Val, declaration.Val, variables.Val));
39543952
return false;
39553953
}
39563954

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,7 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
19481948
if (Stream.EnterSubBlock(bitc::METADATA_BLOCK_ID))
19491949
return error("Invalid record");
19501950

1951+
std::vector<std::pair<DICompileUnit *, Metadata *>> CUSubprograms;
19511952
SmallVector<uint64_t, 64> Record;
19521953

19531954
auto getMD = [&](unsigned ID) -> Metadata * {
@@ -1976,6 +1977,13 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
19761977
case BitstreamEntry::Error:
19771978
return error("Malformed block");
19781979
case BitstreamEntry::EndBlock:
1980+
// Upgrade old-style CU <-> SP pointers to point from SP to CU.
1981+
for (auto CU_SP : CUSubprograms)
1982+
if (auto *SPs = dyn_cast_or_null<MDTuple>(CU_SP.second))
1983+
for (auto &Op : SPs->operands())
1984+
if (auto *SP = dyn_cast_or_null<MDNode>(Op))
1985+
SP->replaceOperandWith(7, CU_SP.first);
1986+
19791987
MetadataList.tryToResolveCycles();
19801988
return std::error_code();
19811989
case BitstreamEntry::Record:
@@ -2232,38 +2240,47 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
22322240

22332241
// Ignore Record[0], which indicates whether this compile unit is
22342242
// distinct. It's always distinct.
2235-
MetadataList.assignValue(
2236-
DICompileUnit::getDistinct(
2237-
Context, Record[1], getMDOrNull(Record[2]),
2238-
getMDString(Record[3]), Record[4], getMDString(Record[5]),
2239-
Record[6], getMDString(Record[7]), Record[8],
2240-
getMDOrNull(Record[9]), getMDOrNull(Record[10]),
2241-
getMDOrNull(Record[11]), getMDOrNull(Record[12]),
2242-
getMDOrNull(Record[13]),
2243-
Record.size() <= 15 ? nullptr : getMDOrNull(Record[15]),
2244-
Record.size() <= 14 ? 0 : Record[14]),
2245-
NextMetadataNo++);
2243+
auto *CU = DICompileUnit::getDistinct(
2244+
Context, Record[1], getMDOrNull(Record[2]), getMDString(Record[3]),
2245+
Record[4], getMDString(Record[5]), Record[6], getMDString(Record[7]),
2246+
Record[8], getMDOrNull(Record[9]), getMDOrNull(Record[10]),
2247+
getMDOrNull(Record[12]), getMDOrNull(Record[13]),
2248+
Record.size() <= 15 ? nullptr : getMDOrNull(Record[15]),
2249+
Record.size() <= 14 ? 0 : Record[14]);
2250+
2251+
MetadataList.assignValue(CU, NextMetadataNo++);
2252+
2253+
// Move the Upgrade the list of subprograms.
2254+
if (Metadata *SPs = getMDOrNull(Record[11]))
2255+
CUSubprograms.push_back({CU, SPs});
22462256
break;
22472257
}
22482258
case bitc::METADATA_SUBPROGRAM: {
22492259
if (Record.size() != 18 && Record.size() != 19)
22502260
return error("Invalid record");
22512261

2252-
bool HasFn = Record.size() == 19;
2262+
// Version 1 has a Function as Record[15].
2263+
// Version 2 has removed Record[15].
2264+
// Version 3 has the Unit as Record[15].
2265+
Metadata *CUorFn = getMDOrNull(Record[15]);
2266+
unsigned Offset = Record.size() == 19 ? 1 : 0;
2267+
bool HasFn = Offset && dyn_cast_or_null<ConstantAsMetadata>(CUorFn);
2268+
bool HasCU = Offset && !HasFn;
22532269
DISubprogram *SP = GET_OR_DISTINCT(
22542270
DISubprogram,
22552271
Record[0] || Record[8], // All definitions should be distinct.
22562272
(Context, getMDOrNull(Record[1]), getMDString(Record[2]),
22572273
getMDString(Record[3]), getMDOrNull(Record[4]), Record[5],
22582274
getMDOrNull(Record[6]), Record[7], Record[8], Record[9],
22592275
getMDOrNull(Record[10]), Record[11], Record[12], Record[13],
2260-
Record[14], getMDOrNull(Record[15 + HasFn]),
2261-
getMDOrNull(Record[16 + HasFn]), getMDOrNull(Record[17 + HasFn])));
2276+
Record[14], HasCU ? CUorFn : nullptr,
2277+
getMDOrNull(Record[15 + Offset]), getMDOrNull(Record[16 + Offset]),
2278+
getMDOrNull(Record[17 + Offset])));
22622279
MetadataList.assignValue(SP, NextMetadataNo++);
22632280

22642281
// Upgrade sp->function mapping to function->sp mapping.
2265-
if (HasFn && Record[15]) {
2266-
if (auto *CMD = dyn_cast<ConstantAsMetadata>(getMDOrNull(Record[15])))
2282+
if (HasFn) {
2283+
if (auto *CMD = dyn_cast<ConstantAsMetadata>(CUorFn))
22672284
if (auto *F = dyn_cast<Function>(CMD->getValue())) {
22682285
if (F->isMaterializable())
22692286
// Defer until materialized; unmaterialized functions may not have

0 commit comments

Comments
 (0)