[PATCH] D93063: [LV] Disable epilogue vectorization for scalable VFs

Cullen Rhodes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 10 13:06:32 PST 2020


c-rhodes created this revision.
c-rhodes added reviewers: sdesmalen, fhahn, dmgreen, bmahjour.
Herald added a subscriber: hiraditya.
c-rhodes requested review of this revision.
Herald added a project: LLVM.

Epilogue vectorization doesn't support scalable vectorization factors
yet, disable it for now.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93063

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp


Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5772,6 +5772,11 @@
 VectorizationFactor
 LoopVectorizationCostModel::selectEpilogueVectorizationFactor(
     const ElementCount MainLoopVF, const LoopVectorizationPlanner &LVP) {
+  // FIXME: This can be fixed for scalable vectors later, because at this stage
+  // the LoopVectorizer will only consider vectorizing a loop with scalable
+  // vectors when the loop has a hint to enable vectorization for a given VF.
+  assert(!MainLoopVF.isScalable() && "scalable vectors not yet supported");
+
   VectorizationFactor Result = VectorizationFactor::Disabled();
   if (!EnableEpilogueVectorization) {
     LLVM_DEBUG(dbgs() << "LEV: Epilogue vectorization is disabled.\n";);
@@ -9202,8 +9207,11 @@
 
     // Consider vectorizing the epilogue too if it's profitable.
     VectorizationFactor EpilogueVF =
-      CM.selectEpilogueVectorizationFactor(VF.Width, LVP);
-    if (EpilogueVF.Width.isVector()) {
+        VF.Width.isScalable()
+            ? VectorizationFactor::Disabled()
+            : CM.selectEpilogueVectorizationFactor(VF.Width, LVP);
+    if (EpilogueVF != VectorizationFactor::Disabled() &&
+        EpilogueVF.Width.isVector()) {
 
       // The first pass vectorizes the main loop and creates a scalar epilogue
       // to be vectorized by executing the plan (potentially with a different


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93063.310999.patch
Type: text/x-patch
Size: 1538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201210/b9d856e5/attachment.bin>


More information about the llvm-commits mailing list