[llvm] [VPlan] Add VPValue for VF, use it for VPWidenIntOrFpInductionRecipe. (PR #95305)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 06:47:04 PDT 2024


================
@@ -385,8 +381,8 @@ define void @test_reversed_load2_store2(ptr noalias nocapture readonly %A, ptr n
 ; CHECK-NEXT:    [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 2
 ; CHECK-NEXT:    [[TMP2:%.*]] = call <vscale x 4 x i32> @llvm.experimental.stepvector.nxv4i32()
 ; CHECK-NEXT:    [[INDUCTION:%.*]] = sub <vscale x 4 x i32> shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> poison, i32 1023, i64 0), <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer), [[TMP2]]
-; CHECK-NEXT:    [[TMP3:%.*]] = call i32 @llvm.vscale.i32()
-; CHECK-NEXT:    [[DOTNEG:%.*]] = mul nsw i32 [[TMP3]], -4
+; CHECK-NEXT:    [[TMP3:%.*]] = trunc nuw nsw i64 [[TMP1]] to i32
----------------
fhahn wrote:

IIUC the fact that VF * UF cannot wrap is a fundamental assumption, but I am not sure if that's spelled out anywhere (there's no upper bound of `vscale` at the LLVM IR level it seems).

Using the assumption, if `vscale * 4` doesn't wrap in i32 (the original code), then it shouldn't wrap in a wider type and the truncate should return the same result

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


More information about the llvm-commits mailing list