Skip to content

Commit fc7c4be

Browse files
committed
PassWrapper: Access GlobalValueSummaryInfo::SummaryList via getter for LLVM 22+
llvm/llvm-project#164355 makes SummaryList private and provides a getter method. @rustbot label llvm-main
1 parent 869fb46 commit fc7c4be

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)