Skip to content

Commit 89aed45

Browse files
authored
Rollup merge of rust-lang#129749 - krasimirgg:llvm-20-lto, r=nikic
llvm-wrapper: adapt for LLVM API changes No functional changes intended. Updates the wrapper for 5c4lar/llvm-project@21eddfa. ```@rustbot``` label: +llvm-main r? ```@nikic```
2 parents e908939 + 9c910e8 commit 89aed45

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,11 @@ struct LLVMRustThinLTOData {
12121212
// Not 100% sure what these are, but they impact what's internalized and
12131213
// what's inlined across modules, I believe.
12141214
#if LLVM_VERSION_GE(18, 0)
1215+
#if LLVM_VERSION_GE(20, 0)
1216+
FunctionImporter::ImportListsTy ImportLists;
1217+
#else
12151218
DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists;
1219+
#endif
12161220
DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists;
12171221
DenseMap<StringRef, GVSummaryMapTy> ModuleToDefinedGVSummaries;
12181222
#else
@@ -1421,13 +1425,13 @@ LLVMRustPrepareThinLTOInternalize(const LLVMRustThinLTOData *Data,
14211425
return true;
14221426
}
14231427

1424-
extern "C" bool LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data,
1428+
extern "C" bool LLVMRustPrepareThinLTOImport(LLVMRustThinLTOData *Data,
14251429
LLVMModuleRef M,
14261430
LLVMTargetMachineRef TM) {
14271431
Module &Mod = *unwrap(M);
14281432
TargetMachine &Target = *unwrap(TM);
14291433

1430-
const auto &ImportList = Data->ImportLists.lookup(Mod.getModuleIdentifier());
1434+
const auto &ImportList = Data->ImportLists[Mod.getModuleIdentifier()];
14311435
auto Loader = [&](StringRef Identifier) {
14321436
const auto &Memory = Data->ModuleMap.lookup(Identifier);
14331437
auto &Context = Mod.getContext();
@@ -1610,7 +1614,7 @@ extern "C" void LLVMRustComputeLTOCacheKey(RustStringRef KeyOut,
16101614
LLVMRustThinLTOData *Data) {
16111615
SmallString<40> Key;
16121616
llvm::lto::Config conf;
1613-
const auto &ImportList = Data->ImportLists.lookup(ModId);
1617+
const auto &ImportList = Data->ImportLists[ModId];
16141618
const auto &ExportList = Data->ExportLists.lookup(ModId);
16151619
const auto &ResolvedODR = Data->ResolvedODR.lookup(ModId);
16161620
const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(ModId);

0 commit comments

Comments
 (0)