summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-08-31 14:46:09 +0200
committerGitHub <noreply@github.com>2024-08-31 14:46:09 +0200
commit8c7a7e346be4cdf13e77ab4acbfb5ade819a4e60 (patch)
treea9d2532e368893f11393dca4843a80c71885dd38 /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parenta00bd75b6c5c96d0a35afa2dc07ce3155112d278 (diff)
parent9c910e81a442eb5962b4438755a2295c16648063 (diff)
downloadrust-8c7a7e346be4cdf13e77ab4acbfb5ade819a4e60.tar.gz
rust-8c7a7e346be4cdf13e77ab4acbfb5ade819a4e60.zip
Rollup merge of #129749 - krasimirgg:llvm-20-lto, r=nikic
llvm-wrapper: adapt for LLVM API changes

No functional changes intended.

Updates the wrapper for https://github.com/5c4lar/llvm-project/commit/21eddfac3d75879b3e0b09c5bc848526dcab6ab0.

````@rustbot```` label: +llvm-main
r? ````@nikic````
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
index c7306b0516f..da27db29c87 100644
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -1212,7 +1212,11 @@ struct LLVMRustThinLTOData {
   // Not 100% sure what these are, but they impact what's internalized and
   // what's inlined across modules, I believe.
 #if LLVM_VERSION_GE(18, 0)
+#if LLVM_VERSION_GE(20, 0)
+  FunctionImporter::ImportListsTy ImportLists;
+#else
   DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists;
+#endif
   DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists;
   DenseMap<StringRef, GVSummaryMapTy> ModuleToDefinedGVSummaries;
 #else
@@ -1421,13 +1425,13 @@ LLVMRustPrepareThinLTOInternalize(const LLVMRustThinLTOData *Data,
   return true;
 }
 
-extern "C" bool LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data,
+extern "C" bool LLVMRustPrepareThinLTOImport(LLVMRustThinLTOData *Data,
                                              LLVMModuleRef M,
                                              LLVMTargetMachineRef TM) {
   Module &Mod = *unwrap(M);
   TargetMachine &Target = *unwrap(TM);
 
-  const auto &ImportList = Data->ImportLists.lookup(Mod.getModuleIdentifier());
+  const auto &ImportList = Data->ImportLists[Mod.getModuleIdentifier()];
   auto Loader = [&](StringRef Identifier) {
     const auto &Memory = Data->ModuleMap.lookup(Identifier);
     auto &Context = Mod.getContext();
@@ -1610,7 +1614,7 @@ extern "C" void LLVMRustComputeLTOCacheKey(RustStringRef KeyOut,
                                            LLVMRustThinLTOData *Data) {
   SmallString<40> Key;
   llvm::lto::Config conf;
-  const auto &ImportList = Data->ImportLists.lookup(ModId);
+  const auto &ImportList = Data->ImportLists[ModId];
   const auto &ExportList = Data->ExportLists.lookup(ModId);
   const auto &ResolvedODR = Data->ResolvedODR.lookup(ModId);
   const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(ModId);