Skip to content

Commit 7cb28c9

Browse files
committed
fromrangeiter-overflow-checks: accept optional signext for argument
On some targets such as LoongArch64 and RISCV64, the ABI requires sign-extension for 32-bit integer arguments, so LLVM may emit the `signext` attribute for the `%range` parameter. The existing CHECK pattern required the argument to be exactly `i32 noundef %range`, causing the test to fail on those targets. Allow an optional `signext` attribute in the CHECK pattern so the test passes consistently across architectures without affecting the intended codegen validation.
1 parent 8a70352 commit 7cb28c9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tests/codegen-llvm/fromrangeiter-overflow-checks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub unsafe fn rangefrom_increments(range: RangeFrom<i32>) -> RangeFrom<i32> {
1919
// Iterator is contained entirely within this function, so the optimizer should
2020
// be able to see that `exhausted` is never set and optimize out any branches.
2121

22-
// CHECK: i32 noundef %range
22+
// CHECK: i32 noundef {{(signext )?}}%range
2323
// DEBUG: switch i32 %range
2424
// DEBUG: call core::panicking::panic_const::panic_const_add_overflow
2525
// DEBUG: unreachable

0 commit comments

Comments
 (0)