[llvm] [VPlan] Use wide IV if scalar lanes > 0 are used with scalable vectors. (PR #169796)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 1 08:54:31 PST 2025


================
@@ -15,25 +15,22 @@ define void @test_invar_gep(ptr %dst) #0 {
 ; CHECK-NEXT:    [[TMP3:%.*]] = mul nuw i64 [[TMP2]], 4
 ; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i64 100, [[TMP3]]
 ; CHECK-NEXT:    [[N_VEC:%.*]] = sub i64 100, [[N_MOD_VF]]
+; CHECK-NEXT:    [[TMP5:%.*]] = call <vscale x 4 x i64> @llvm.stepvector.nxv4i64()
+; CHECK-NEXT:    [[TMP4:%.*]] = mul nsw <vscale x 4 x i64> [[TMP5]], splat (i64 1)
----------------
fhahn wrote:

Yes, there are cases where we currently may not be able to sink I think. The tests cover (the only?) code path where we extract the last lane of an IV in the loop for scalable vectors.

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


More information about the llvm-commits mailing list