[llvm] [LV] Extend FindLastIV to unsigned case (PR #141752)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 04:04:11 PDT 2025


================
@@ -623,6 +623,207 @@ exit:                                            ; preds = %for.body
   ret i32 %spec.select
 }
 
+; The construct that are introduced by IndVarSimplify is:
+;   %1 = trunc i64 %iv to i32
+; The loop exit condition is a constant that overflows signed i32,
+; but not unsigned i32:
+;   %exitcond.not = icmp eq i64 %inc, 4294967294
+; Hence, we can vectorize with the unsigned variant of FindLastIV.
+define i32 @select_icmp_truncated_unsigned_iv_range(ptr %a) {
----------------
artagnon wrote:

There's a negative test called not_vectorized_select_icmp_iv_out_of_bound, which should be sufficient. I've added a positive test in the non-trunc case.

https://github.com/llvm/llvm-project/pull/141752


More information about the llvm-commits mailing list