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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 02:59:15 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) {
----------------
fhahn wrote:

I think we can also add a simpler test, w/o the need for a trunc, by having the IV starting < unsigned(SignedMin) and ending at a constant > unsigned(SignedMin), unless that's already covered?

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


More information about the llvm-commits mailing list