PassWrapper: Access GlobalValueSummaryInfo::SummaryList via getter for LLVM 22+

https://github.com/llvm/llvm-project/pull/164355 makes SummaryList private and provides a getter method.

@rustbot label llvm-main
This commit is contained in:
Arthur Eubanks
2025-10-21 20:58:27 +00:00
parent 869fb4679f
commit fc7c4be59a

View File

@@ -1220,9 +1220,14 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, size_t num_modules,
// being lifted from `lib/LTO/LTO.cpp` as well
DenseMap<GlobalValue::GUID, const GlobalValueSummary *> PrevailingCopy;
for (auto &I : Ret->Index) {
if (I.second.SummaryList.size() > 1)
#if LLVM_VERSION_GE(22, 0)
const auto &SummaryList = I.second.getSummaryList();
#else
const auto &SummaryList = I.second.SummaryList;
#endif
if (SummaryList.size() > 1)
PrevailingCopy[I.first] =
getFirstDefinitionForLinker(I.second.SummaryList);
getFirstDefinitionForLinker(SummaryList);
}
auto isPrevailing = [&](GlobalValue::GUID GUID, const GlobalValueSummary *S) {
const auto &Prevailing = PrevailingCopy.find(GUID);
@@ -1253,7 +1258,12 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, size_t num_modules,
// linkage will stay as external, and internal will stay as internal.
std::set<GlobalValue::GUID> ExportedGUIDs;
for (auto &List : Ret->Index) {
for (auto &GVS : List.second.SummaryList) {
#if LLVM_VERSION_GE(22, 0)
const auto &SummaryList = List.second.getSummaryList();
#else
const auto &SummaryList = List.second.SummaryList;
#endif
for (auto &GVS : SummaryList) {
if (GlobalValue::isLocalLinkage(GVS->linkage()))
continue;
auto GUID = GVS->getOriginalName();