[llvm] [IVDesc] Fix off-by-one error in FindFirstIV ranges (PR #174441)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 12 07:53:13 PST 2026


================
@@ -970,7 +970,7 @@ define i64 @not_vectorized_select_decreasing_induction_icmp_iv_out_of_bound(ptr
 ; CHECK-NEXT:  [[ENTRY:.*]]:
 ; CHECK-NEXT:    br label %[[LOOP:.*]]
 ; CHECK:       [[LOOP]]:
-; CHECK-NEXT:    [[IV:%.*]] = phi i64 [ -1, %[[ENTRY]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]
+; CHECK-NEXT:    [[IV:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ]
----------------
fhahn wrote:

presumably the test would vectorize when starting at -1, due to the off by one error fixed? If so, would be good to keep a variant as positive test, shwoing additional vectorization by fixing the off-by-one

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


More information about the llvm-commits mailing list