Skip to content

Commit c026640

Browse files
Rollup merge of #154360 - heiher:fromrangeiter-overflow-checks, r=jieyouxu
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.
2 parents 796d52f + 7cb28c9 commit c026640

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎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)