@@ -1220,9 +1220,14 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, size_t num_modules,
12201220 // being lifted from `lib/LTO/LTO.cpp` as well
12211221 DenseMap<GlobalValue::GUID, const GlobalValueSummary *> PrevailingCopy;
12221222 for (auto &I : Ret->Index ) {
1223- if (I.second .SummaryList .size () > 1 )
1223+ #if LLVM_VERSION_GE(22, 0)
1224+ const auto &SummaryList = I.second .getSummaryList ();
1225+ #else
1226+ const auto &SummaryList = I.second .SummaryList ;
1227+ #endif
1228+ if (SummaryList.size () > 1 )
12241229 PrevailingCopy[I.first ] =
1225- getFirstDefinitionForLinker (I. second . SummaryList );
1230+ getFirstDefinitionForLinker (SummaryList);
12261231 }
12271232 auto isPrevailing = [&](GlobalValue::GUID GUID, const GlobalValueSummary *S) {
12281233 const auto &Prevailing = PrevailingCopy.find (GUID);
@@ -1253,7 +1258,12 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, size_t num_modules,
12531258 // linkage will stay as external, and internal will stay as internal.
12541259 std::set<GlobalValue::GUID> ExportedGUIDs;
12551260 for (auto &List : Ret->Index ) {
1256- for (auto &GVS : List.second .SummaryList ) {
1261+ #if LLVM_VERSION_GE(22, 0)
1262+ const auto &SummaryList = List.second .getSummaryList ();
1263+ #else
1264+ const auto &SummaryList = List.second .SummaryList ;
1265+ #endif
1266+ for (auto &GVS : SummaryList) {
12571267 if (GlobalValue::isLocalLinkage (GVS->linkage ()))
12581268 continue ;
12591269 auto GUID = GVS->getOriginalName ();
0 commit comments