[PATCH] D121595: [LoopVectorize] Permit tail-folding for low trip counts using scalable vectors

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 03:59:25 PDT 2022


sdesmalen added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5249
 
-  // For scalable vectors don't use tail folding for low trip counts or
-  // optimizing for code size. We only permit this if the user has explicitly
-  // requested it.
-  if (ScalarEpilogueStatus != CM_ScalarEpilogueNotNeededUsePredicate &&
-      ScalarEpilogueStatus != CM_ScalarEpilogueNotAllowedUsePredicate &&
+  // For scalable vectors don't use tail folding when optimizing for code size.
+  if (ScalarEpilogueStatus == CM_ScalarEpilogueNotAllowedOptSize &&
----------------
I think we can remove the condition entirely, so that we consider using scalable vectors + tail folding when optimising for code-size as well.

I know that for SVE we'll want to improve code quality to avoid the redundant compare, but when optimising for code-size the user has made the decision that code-size is more important than performance. And the cost-model will still have a say in which is more beneficial (scalar, fixed or scalable) and may still choose a fixed-width VF in case the ScalableVF may not be legal for the loop.


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

https://reviews.llvm.org/D121595



More information about the llvm-commits mailing list