[PATCH] D121452: [VPlan] Avoid scalarization for scalable vectors.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 05:36:57 PDT 2022


sdesmalen added inline comments.


================
Comment at: llvm/test/Transforms/LoopVectorize/AArch64/scalable-avoid-scalarization.ll:8
+; It creates a scenario where the gep instruction is used outside
+; the loop, preventing it (and consequently the loop induction
+; update variable) from being classified as 'uniform'.
----------------
nit:
    s/it (and consequently [...] variable) from being classified as 'uniform'./
      the gep and consequently the loop induction update variable from being classified as 'uniform'/


================
Comment at: llvm/test/Transforms/LoopVectorize/AArch64/scalable-avoid-scalarization.ll:42
+; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
+; CHECK:       vector.body:
+; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
----------------
It looks like this loop has been vectorized with an Interleave Factor of 2. Can you limit that using `-force-vector-interleave=1`, to reduce the number of CHECK lines?


================
Comment at: llvm/test/Transforms/LoopVectorize/AArch64/scalable-avoid-scalarization.ll:100-102
+  %idx = alloca i32, align 4
+  store i32 100, i32* %idx, align 4
+  %0 = load i32, i32* %idx
----------------
nit: this alloca and the subsequent load/store seem unnecessary. Maybe you can just pass in some `i32 %N` as function argument for the number of iterations.


================
Comment at: llvm/test/Transforms/LoopVectorize/AArch64/scalable-avoid-scalarization.ll:107
+  %indvars.iv = phi i32 [ %indvars.iv.next, %L.LB19_336 ], [ %0, %L.entry ]
+  %indvars.iv.next = add nsw i32 %indvars.iv, -1
+  %1 = getelementptr i64, i64* %a, i32 %indvars.iv
----------------
Can you make a loop that increments instead of decrements? That avoids the calls to `@llvm.experimental.vector.reverse.nxv2f64` and makes the CHECK lines a bit simpler.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121452/new/

https://reviews.llvm.org/D121452



More information about the llvm-commits mailing list