Skip to content

Commit a015b06

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. The above also applies for ffi-out-of-bounds-loads.rs. r? dianqk @rustbot label llvm-main
1 parent ab5b1be commit a015b06

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Diff for: 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

Diff for: 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

Diff for: tests/codegen/cffi/ffi-out-of-bounds-loads.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ add-core-stubs
22
//@ revisions: linux apple
33
//@ min-llvm-version: 19
4-
//@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error
4+
//@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir
55

66
//@[linux] compile-flags: --target x86_64-unknown-linux-gnu
77
//@[linux] needs-llvm-components: x86

0 commit comments

Comments
 (0)