[PATCH] D95245: [SVE] Add support for scalable vectorization of loops with int/fast FP reductions

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 04:39:34 PST 2021


fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5661
   if (UserVF.isNonZero() && !IgnoreScalableUserVF &&
-      Legal->isSafeForAnyVectorWidth())
+      Legal->isSafeForAnyVectorWidth()) {
+    if (!canVectorizeReductions(UserVF)) {
----------------
david-arm wrote:
> I think this looks much better now you're just checking reductions only once and early on - thanks for this! However, I think you might need to move this check down to line 5677 where we return UserVF. So the reason I think this is because if we have a loop that contains memory dependences and reductions in the same loop we want to ensure we always do the reduction checks regardless. For example, Legal->isSafeForAnyVectorWidth() could return false and then in the code below we may successfully reduce the UserVF from <vscale x 8 x float> to <vscale x 4 x float> without ever calling canVectorizeReductions.
please also add a test for this scenario.


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

https://reviews.llvm.org/D95245



More information about the llvm-commits mailing list