Skip to content

Commit 1b5e3e0

Browse files
authored
Unrolled build for #148859
Rollup merge of #148859 - ZhongyaoChen:fix-riscv-overflow-checks-test-fail, r=Mark-Simulacrum Fix overflow-checks test for RISC-V target The overflow-checks codegen test was failing on riscv64gc target because the FileCheck pattern did not account for ABI extension attributes. RISC-V LP64 ABI requires integer types smaller than XLEN (64-bit) to be zero-extended or sign-extended to register width. For u8 parameters, RISC-V generates: i8 noundef zeroext %a, i8 noundef zeroext %b While x86_64 and aarch64 generate: i8 noundef %a, i8 noundef %b The original CHECK pattern only matched the format without the `zeroext` attribute, causing test failures on RISC-V. This patch makes the zeroext attribute optional in the FileCheck pattern using `{{( zeroext)?}}`, allowing the test to pass on architectures that add ABI extension attributes (e.g., RISC-V). Test results before fix: - x86_64-unknown-linux-gnu: 3 passed - aarch64-unknown-linux-gnu: 3 passed - riscv64gc-unknown-linux-gnu: 1 passed, 2 failed Test results after fix: - x86_64-unknown-linux-gnu: 3 passed - aarch64-unknown-linux-gnu: 3 passed - riscv64gc-unknown-linux-gnu: 3 passed
2 parents 54f4176 + eef09cf commit 1b5e3e0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/codegen-llvm/overflow-checks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extern crate overflow_checks_add;
1818
// CHECK-LABEL: @add(
1919
#[no_mangle]
2020
pub unsafe fn add(a: u8, b: u8) -> u8 {
21-
// CHECK: i8 noundef %a, i8 noundef %b
21+
// CHECK: i8 noundef{{( zeroext)?}} %a, i8 noundef{{( zeroext)?}} %b
2222
// CHECK: add i8 %b, %a
2323
// DEBUG: icmp ult i8 [[zero:[^,]+]], %a
2424
// DEBUG: call core::num::overflow_panic::add

0 commit comments

Comments
 (0)