Skip to content

Commit b14a0ce

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 b14a0ce

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

Diff for: compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -855,10 +855,15 @@ extern "C" LLVMRustResult LLVMRustOptimize(
855855
}
856856

857857
if (LintIR) {
858-
PipelineStartEPCallbacks.push_back(
859-
[](ModulePassManager &MPM, OptimizationLevel Level) {
860-
MPM.addPass(createModuleToFunctionPassAdaptor(LintPass()));
861-
});
858+
PipelineStartEPCallbacks.push_back([](ModulePassManager &MPM,
859+
OptimizationLevel Level) {
860+
#if LLVM_VERSION_GE(21, 0)
861+
MPM.addPass(
862+
createModuleToFunctionPassAdaptor(LintPass(/*AbortOnError=*/true)));
863+
#else
864+
MPM.addPass(createModuleToFunctionPassAdaptor(LintPass()));
865+
#endif
866+
});
862867
}
863868

864869
if (InstrumentCoverage) {

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)