Skip to content

Conversation

@ZhongyaoChen
Copy link
Contributor

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

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
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 12, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants