Skip to content

Commit cccbb16

Browse files
committed
PassWrapper: adapt for llvm/llvm-project@94122d5
We also have to remove the LLVM argument in cast-target-abi.rs for LLVM 21. I'm not really sure what the best approach here is since that test already uses revisions. We could also fork the test into a copy for LLVM 19-20 and another for LLVM 21, but what I did for now was drop the lint-abort-on-error flag to LLVM figuring that some coverage was better than none, but I'm happy to change this if that was a bad direction. r? dianqk @rustbot label llvm-main
1 parent ab5b1be commit cccbb16

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,11 @@ extern "C" LLVMRustResult LLVMRustOptimize(
857857
if (LintIR) {
858858
PipelineStartEPCallbacks.push_back(
859859
[](ModulePassManager &MPM, OptimizationLevel Level) {
860+
#if LLVM_VERSION_GE(21, 0)
861+
MPM.addPass(createModuleToFunctionPassAdaptor(LintPass(/*AbortOnError=*/true)));
862+
#else
860863
MPM.addPass(createModuleToFunctionPassAdaptor(LintPass()));
864+
#endif
861865
});
862866
}
863867

tests/codegen/cast-target-abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ add-core-stubs
33
//@ revisions:aarch64 loongarch64 powerpc64 sparc64 x86_64
44
//@ min-llvm-version: 19
5-
//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error
5+
//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -Zlint-llvm-ir
66

77
//@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu
88
//@[aarch64] needs-llvm-components: arm

0 commit comments

Comments
 (0)