[PATCH] D116928: [LoopVectorize] Support epilogue vectorisation of loops with reductions

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 10 08:24:59 PST 2022


bmahjour added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8317
+  // The vec.epilog.iter.check block may contain Phi nodes from reductions which
+  // merge control-flow from the backedge-taken check block and the middle block.
+  // Update the incoming values here and move the Phi into the preheader:
----------------
"backedge-taken check block"?
do you mean the latch block?


================
Comment at: llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vect-inloop-reductions.ll:107
+  %iv = phi i64 [ %iv.next, %for.body ], [ 0, %entry ]
+  %rdx = phi i64 [ %and, %for.body ], [ 0, %entry ]
+  %l2 = getelementptr inbounds i64, i64* %a, i64 %iv
----------------
Would be more meaningful to have `[ 1, %entry ] or [ 0xFFFFFFFF, %entry ]`, instead of `[ 0, %entry ]`


================
Comment at: llvm/test/Transforms/LoopVectorize/epilog-vectorization-reductions.ll:499
+  ret i16 %ret
+}
----------------
Please add a test case for when there are more than one reductions, eg:
```
float foo(float *arr, int n) {
  float sum = 0.0;
  float prod = 1.0;
  for (int i = 0; i < n; i++) {
    sum += arr[i];
    prod *= arr[i];
  }
  return prod/sum;
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116928



More information about the llvm-commits mailing list