Skip to content

Commit 042862e

Browse files
maurerSquallATF
authored andcommitted
llvm: Ignore error value that is always false
See llvm/llvm-project#121851 For LLVM 20+, this function (`renameModuleForThinLTO`) has no return value. For prior versions of LLVM, this never failed, but had a signature which allowed an error value people were handling.
1 parent e71f9a9 commit 042862e

File tree

4 files changed

+5
-17
lines changed

4 files changed

+5
-17
lines changed

compiler/rustc_codegen_gcc/src/back/lto.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,9 +660,7 @@ pub unsafe fn optimize_thin_module(
660660
{
661661
let _timer =
662662
cgcx.prof.generic_activity_with_arg("LLVM_thin_lto_rename", thin_module.name());
663-
if !llvm::LLVMRustPrepareThinLTORename(thin_module.shared.data.0, llmod, target) {
664-
return Err(write::llvm_err(&dcx, LlvmError::PrepareThinLtoModule));
665-
}
663+
unsafe { llvm::LLVMRustPrepareThinLTORename(thin_module.shared.data.0, llmod, target) };
666664
save_temp_bitcode(cgcx, &module, "thin-lto-after-rename");
667665
}
668666

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,7 @@ pub(crate) unsafe fn optimize_thin_module(
730730
{
731731
let _timer =
732732
cgcx.prof.generic_activity_with_arg("LLVM_thin_lto_rename", thin_module.name());
733-
if unsafe {
734-
!llvm::LLVMRustPrepareThinLTORename(thin_module.shared.data.0, llmod, target)
735-
} {
736-
return Err(write::llvm_err(dcx, LlvmError::PrepareThinLtoModule));
737-
}
733+
unsafe { llvm::LLVMRustPrepareThinLTORename(thin_module.shared.data.0, llmod, target) };
738734
save_temp_bitcode(cgcx, &module, "thin-lto-after-rename");
739735
}
740736

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2387,7 +2387,7 @@ unsafe extern "C" {
23872387
Data: &ThinLTOData,
23882388
Module: &Module,
23892389
Target: &TargetMachine,
2390-
) -> bool;
2390+
);
23912391
pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
23922392
pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
23932393
pub fn LLVMRustPrepareThinLTOImport(

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,20 +1373,14 @@ static bool clearDSOLocalOnDeclarations(Module &Mod, TargetMachine &TM) {
13731373
return ClearDSOLocalOnDeclarations;
13741374
}
13751375

1376-
extern "C" bool LLVMRustPrepareThinLTORename(const LLVMRustThinLTOData *Data,
1376+
extern "C" void LLVMRustPrepareThinLTORename(const LLVMRustThinLTOData *Data,
13771377
LLVMModuleRef M,
13781378
LLVMTargetMachineRef TM) {
13791379
Module &Mod = *unwrap(M);
13801380
TargetMachine &Target = *unwrap(TM);
13811381

13821382
bool ClearDSOLocal = clearDSOLocalOnDeclarations(Mod, Target);
1383-
bool error = renameModuleForThinLTO(Mod, Data->Index, ClearDSOLocal);
1384-
1385-
if (error) {
1386-
LLVMRustSetLastError("renameModuleForThinLTO failed");
1387-
return false;
1388-
}
1389-
return true;
1383+
renameModuleForThinLTO(Mod, Data->Index, ClearDSOLocal);
13901384
}
13911385

13921386
extern "C" bool

0 commit comments

Comments
 (0)