-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Fix RISC-V Test Failures in ./x test for Multiple Codegen and Assembly Cases #143915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Fix tests/assembly/dwarf-mixed-versions-lto.rs test failure on riscv64.
Fix tests/codegen/const-vector.rs test failure on riscv64.
Fix tests/codegen/enum/enum-aggregate.rs test failure on riscv64.
Fix tests/codegen/simd/extract-insert-dyn.rs test failure on riscv64.
Fix tests/codegen/transmute-scalar.rs test failure on riscv64.
Fix tests/codegen/uninhabited-transparent-return-abi.rs test failure on riscv64.
rustbot has assigned @Mark-Simulacrum. Use |
@Mark-Simulacrum I have merged different revisions into a single file. |
This comment has been minimized.
This comment has been minimized.
Fix tidy check error.
This comment has been minimized.
This comment has been minimized.
Fix regex matching error.
cc @nikic for whether there's a better pattern for us to follow in codegen tests to normalize/ignore the per-target ABI questions (E.g., signext above), or if we should instead retain test coverage very explicitly of them. |
@Mark-Simulacrum Ignoring ABI attributes via |
@nikic I'm not sure I understand. If I don't make any changes, running |
The test should specify
To always run against the x86 triple even if you are running on a riscv host. |
@nikic It will fail the test if I don't install the |
@CaiWeiran Using |
Ignore cross-compile.
This PR modifies cc @jieyouxu |
This reverts commit d464e57.
☔ The latest upstream changes (presumably #144249) made this pull request unmergeable. Please resolve the merge conflicts. |
r=me with commits squashed, I don't think this needs more than one commit. |
@@ -79,7 +80,7 @@ pub fn bool_to_fake_bool_signed(b: bool) -> FakeBoolSigned { | |||
unsafe { mem::transmute(b) } | |||
} | |||
|
|||
// CHECK-LABEL: define{{.*}}i1 @fake_bool_signed_to_bool(i8 %b) | |||
// CHECK-LABEL: define{{.*}}i1 @fake_bool_signed_to_bool(i8 {{.*}}%b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least for things like this one that aren't about SIMD, the point of having the signature is basically just to make it easier to read the verifications and check that the argument has the expected name (as opposed to being called %0
because of the ABI or LocalKind
or something).
So for things like that, I think ignoring extra flags in here is acceptable -- though admittedly slightly unusual because it's a -C no-prepopulate-passes
test. (In optimized tests it's very common to have a wildcard for resiliency against LLVM adding new parameter attributes.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, though if it's just an optional extension flag, consider using
// CHECK-LABEL: define{{.*}}i1 @fake_bool_signed_to_bool(i8 {{.*}}%b) | |
// CHECK-LABEL: define{{.*}}i1 @fake_bool_signed_to_bool(i8{{( zeroext)?}} %b) |
because you know exactly what you're ignoring in this case, rather than allowing for arbitrary future attributes that might be added by the optimizer.
pub extern "C" fn single_element_simd_to_scalar(b: S) -> i64 { | ||
unsafe { mem::transmute(b) } | ||
} | ||
|
||
// CHECK-LABEL: define{{.*}}<1 x i64> @scalar_to_single_element_simd(i64 %b) | ||
// CHECK-LABEL: define{{.*}}i64{{.*}} @scalar_to_single_element_simd(i64 %b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm less sure what should be done for this case. Is it even BackendRepr::SimdVector
in these cases if it's not a vector type in the ABI? Should these SIMD ones be split into another file from the scalar ones? Should it be more like {{ i64| <1 x i64>}}
if those are the only two realistic possibilities for what will be here?
unsafe extern "C" fn dyn_simd_insert(x: i8x16, e: i8, idx: u32) -> i8x16 { | ||
simd_insert_dyn(x, idx, e) | ||
} | ||
|
||
// CHECK-LABEL: literal_dyn_simd_insert | ||
// CHECK: insertelement <16 x i8> %x, i8 %e, i32 7 | ||
// CHECK: insertelement <16 x i8> %[[TEMP:.+]], i8 %e, i32 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: if you're not going to consume the variable again later (by mentioning %[[TEMP]]
somewhere) then I think you should just use a {{regex}}
not a [[NAME:regex]]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed the ping here. I've dropped some thoughts, but nothing super-critical, so feel free to do with them what you will, since you already have an approval.
Resumption of #143792.
This PR addresses and resolves several test failures that occurred when running
./x test
on the RISC-V architecture. The issues were due to platform-specific behavior, ABI differences, or code generation inconsistencies specific to RISC-V.The following tests have been fixed:
assembly/dwarf-mixed-versions-lto.rs
codegen/const-vector.rs
codegen/enum/enum-aggregate.rs
codegen/simd/extract-insert-dyn.rs
codegen/transmute-scalar.rs
codegen/uninhabited-transparent-return-abi.rs
All changes have been tested locally with
./x test
on a RISC-V target and now pass as expected.Notes: