rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.55k stars 12.74k forks source link

tests/ui/abi/sparcv8plus.rs#sparc_cpu_v9 broken in LLVM 20 #132957

Open durin42 opened 2 days ago

durin42 commented 2 days ago

It looks like this is basically expected: the test has some FIXME comments referencing LLVM 20 around the failure. I tried to write a fix that would let the tests work on both LLVM 19 and 20, and I just can't thread the needle correctly.

I think we'd probably have to have an llvm-19 flavor of the test file and an llvm-20 one, because the revisions feature is already being used to specify various flavors of SPARC here.

durin42 commented 2 days ago

In case anyone wants to dig, the test was added in #132552.

taiki-e commented 2 days ago

It looks like this is basically expected

Yes, failure in LLVM 20 is expected. (I'm the author of that PR)

I think we need to split the revisions failing in LLVM 20 into llvm20 and pre-llvm20 like in this test:

https://github.com/rust-lang/rust/blob/6503543d11583d1686d4989847b2afbec8d9fdba/tests/codegen/integer-cmp.rs#L4-L6

durin42 commented 2 days ago

Yeah, except I don't think we can have multiple revisions: stanzas in the test. If you like, I'm happy to figure out a plan if you can show me what the test should look like for LLVM 20. I got confused by the error-output checking logic and couldn't make effective progress. :(

jieyouxu commented 1 day ago

I think we need to split the revisions failing in LLVM 20 into llvm20 and pre-llvm20 like in this test:

Something like

//@ revisions: ... sparc_cpu_v9_pre_llvm20
//@[sparc_cpu_v9_pre_llvm20] compile-flags: --target sparc-unknown-none-elf -C target-cpu=v9
//@[sparc_cpu_v9_pre_llvm20] needs-llvm-components: sparc
//@[sparc_cpu_v9_pre_llvm20] max-llvm-major-version: 19

after https://github.com/rust-lang/rust/pull/132310 lands.

taiki-e commented 1 day ago

I haven't tested it, but the following changes are probably needed

-//@ revisions: sparc sparcv8plus sparc_cpu_v9 sparc_feature_v8plus sparc_cpu_v9_feature_v8plus
+//@ revisions: sparc sparcv8plus sparc_cpu_v9 sparc_cpu_v9_pre_llvm20 sparc_feature_v8plus sparc_cpu_v9_feature_v8plus
 //@[sparc] compile-flags: --target sparc-unknown-none-elf
 //@[sparc] needs-llvm-components: sparc
 //@[sparcv8plus] compile-flags: --target sparc-unknown-linux-gnu
 //@[sparcv8plus] needs-llvm-components: sparc
+//@[sparcv8plus] min-llvm-version: 19
 //@[sparc_cpu_v9] compile-flags: --target sparc-unknown-none-elf -C target-cpu=v9
 //@[sparc_cpu_v9] needs-llvm-components: sparc
+//@[sparc_cpu_v9] min-llvm-version: 20
+//@[sparc_cpu_v9_pre_llvm20] compile-flags: --target sparc-unknown-none-elf -C target-cpu=v9
+//@[sparc_cpu_v9_pre_llvm20] needs-llvm-components: sparc
+//@[sparc_cpu_v9_pre_llvm20] min-llvm-version: 19
+//@[sparc_cpu_v9_pre_llvm20] max-llvm-version: 19
 //@[sparc_feature_v8plus] compile-flags: --target sparc-unknown-none-elf -C target-feature=+v8plus
 //@[sparc_feature_v8plus] needs-llvm-components: sparc
 //@[sparc_cpu_v9_feature_v8plus] compile-flags: --target sparc-unknown-none-elf -C target-cpu=v9 -C target-feature=+v8plus
 //@[sparc_cpu_v9_feature_v8plus] needs-llvm-components: sparc
-//@ max-llvm-version: 19
-// FIXME: sparc_cpu_v9 should be in "-v8plus,+v9" group (fixed in LLVM 20)
 #[cfg(all(target_feature = "v8plus", target_feature = "v9"))]
 compile_error!("+v8plus,+v9");
-//[sparcv8plus,sparc_cpu_v9_feature_v8plus,sparc_cpu_v9]~^ ERROR +v8plus,+v9
+//[sparcv8plus,sparc_cpu_v9_feature_v8plus,sparc_cpu_v9_pre_llvm20]~^ ERROR +v8plus,+v9

 // FIXME: should be rejected
 #[cfg(all(target_feature = "v8plus", not(target_feature = "v9")))]
 compile_error!("+v8plus,-v9 (FIXME)");
 //[sparc_feature_v8plus]~^ ERROR +v8plus,-v9 (FIXME)

 #[cfg(all(not(target_feature = "v8plus"), target_feature = "v9"))]
 compile_error!("-v8plus,+v9");
+//[sparc_cpu_v9]~^ ERROR -v8plus,+v9
jieyouxu commented 1 day ago
+//@[sparc_cpu_v9_pre_llvm20] min-llvm-version: 19
+//@[sparc_cpu_v9_pre_llvm20] max-llvm-version: 19

After #132995 lands we will be able to write //@ exact-llvm-major-version: 19.