Skip to content

Commit f8090dd

Browse files
authored
Rollup merge of rust-lang#130477 - tmandry:revert-llvm-20-lto, r=tmandry
Revert rust-lang#129749 to fix segfault in LLVM This reverts commit 8c7a7e3, reversing changes made to a00bd75. Reported in rust-lang#129749 (comment). `@nikic's` theory is that the LLVM API changed in a way that makes it impossible to use concurrently from multiple threads (llvm/llvm-project#106427 (comment)). I pinged `@krasimirgg` who was fine with reverting. r? `@rust-lang/wg-llvm`
2 parents 9087312 + 472fef6 commit f8090dd

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -1211,11 +1211,7 @@ struct LLVMRustThinLTOData {
12111211
// Not 100% sure what these are, but they impact what's internalized and
12121212
// what's inlined across modules, I believe.
12131213
#if LLVM_VERSION_GE(18, 0)
1214-
#if LLVM_VERSION_GE(20, 0)
1215-
FunctionImporter::ImportListsTy ImportLists;
1216-
#else
12171214
DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists;
1218-
#endif
12191215
DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists;
12201216
DenseMap<StringRef, GVSummaryMapTy> ModuleToDefinedGVSummaries;
12211217
#else
@@ -1424,13 +1420,13 @@ LLVMRustPrepareThinLTOInternalize(const LLVMRustThinLTOData *Data,
14241420
return true;
14251421
}
14261422

1427-
extern "C" bool LLVMRustPrepareThinLTOImport(LLVMRustThinLTOData *Data,
1423+
extern "C" bool LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data,
14281424
LLVMModuleRef M,
14291425
LLVMTargetMachineRef TM) {
14301426
Module &Mod = *unwrap(M);
14311427
TargetMachine &Target = *unwrap(TM);
14321428

1433-
const auto &ImportList = Data->ImportLists[Mod.getModuleIdentifier()];
1429+
const auto &ImportList = Data->ImportLists.lookup(Mod.getModuleIdentifier());
14341430
auto Loader = [&](StringRef Identifier) {
14351431
const auto &Memory = Data->ModuleMap.lookup(Identifier);
14361432
auto &Context = Mod.getContext();
@@ -1613,7 +1609,7 @@ extern "C" void LLVMRustComputeLTOCacheKey(RustStringRef KeyOut,
16131609
LLVMRustThinLTOData *Data) {
16141610
SmallString<40> Key;
16151611
llvm::lto::Config conf;
1616-
const auto &ImportList = Data->ImportLists[ModId];
1612+
const auto &ImportList = Data->ImportLists.lookup(ModId);
16171613
const auto &ExportList = Data->ExportLists.lookup(ModId);
16181614
const auto &ResolvedODR = Data->ResolvedODR.lookup(ModId);
16191615
const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(ModId);

0 commit comments

Comments
 (0)