From 7cb28c980dc5893c33a51be816f625cf695e4755 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Wed, 25 Mar 2026 16:59:43 +0800 Subject: [PATCH] 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. --- tests/codegen-llvm/fromrangeiter-overflow-checks.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/codegen-llvm/fromrangeiter-overflow-checks.rs b/tests/codegen-llvm/fromrangeiter-overflow-checks.rs index 455c81c63340..e1e521103b57 100644 --- a/tests/codegen-llvm/fromrangeiter-overflow-checks.rs +++ b/tests/codegen-llvm/fromrangeiter-overflow-checks.rs @@ -19,7 +19,7 @@ pub unsafe fn rangefrom_increments(range: RangeFrom) -> RangeFrom { // Iterator is contained entirely within this function, so the optimizer should // be able to see that `exhausted` is never set and optimize out any branches. - // CHECK: i32 noundef %range + // CHECK: i32 noundef {{(signext )?}}%range // DEBUG: switch i32 %range // DEBUG: call core::panicking::panic_const::panic_const_add_overflow // DEBUG: unreachable