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

Cullen Rhodes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 17 04:14:28 PST 2020


This revision was automatically updated to reflect the committed changes.
c-rhodes marked an inline comment as done.
Closed by commit rG1fd3a0477597: [LV] Disable epilogue vectorization for scalable VFs (authored by c-rhodes).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93063

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/optimal-epilog-vectorization-limitations.ll


Index: llvm/test/Transforms/LoopVectorize/optimal-epilog-vectorization-limitations.ll
===================================================================
--- llvm/test/Transforms/LoopVectorize/optimal-epilog-vectorization-limitations.ll
+++ llvm/test/Transforms/LoopVectorize/optimal-epilog-vectorization-limitations.ll
@@ -99,3 +99,27 @@
 for.end:                                          ; preds = %for.end.loopexit, %entry
   ret void
 }
+
+; Currently we cannot handle scalable vectorization factors.
+; CHECK: LV: Checking a loop in "f4"
+; CHECK: LEV: Epilogue vectorization for scalable vectors not yet supported.
+
+define void @f4(i8* %A) {
+entry:
+  br label %for.body
+
+for.body:
+  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
+  %arrayidx = getelementptr inbounds i8, i8* %A, i64 %iv
+  store i8 1, i8* %arrayidx, align 1
+  %iv.next = add nuw nsw i64 %iv, 1
+  %exitcond = icmp ne i64 %iv.next, 1024
+  br i1 %exitcond, label %for.body, label %exit, !llvm.loop !0
+
+exit:
+  ret void
+}
+
+!0 = !{!0, !1, !2}
+!1 = !{!"llvm.loop.vectorize.width", i32 4}
+!2 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}
Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5784,6 +5784,15 @@
     return Result;
   }
 
+  // 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.
+  if (MainLoopVF.isScalable()) {
+    LLVM_DEBUG(dbgs() << "LEV: Epilogue vectorization for scalable vectors not "
+                         "yet supported.\n");
+    return Result;
+  }
+
   // Not really a cost consideration, but check for unsupported cases here to
   // simplify the logic.
   if (!isCandidateForEpilogueVectorization(*TheLoop, MainLoopVF)) {


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


More information about the llvm-commits mailing list