[llvm] r344483 - [LV] Fix comments reported when not vectorizing single iteration loops; NFC

Ayal Zaks via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 14 10:53:02 PDT 2018


Author: ayalz
Date: Sun Oct 14 10:53:02 2018
New Revision: 344483

URL: http://llvm.org/viewvc/llvm-project?rev=344483&view=rev
Log:
[LV] Fix comments reported when not vectorizing single iteration loops; NFC

Landing this as a separate part of https://reviews.llvm.org/D50480, being a
seemingly unrelated change ([LV] Vectorizing loops of arbitrary trip count
without remainder under opt for size).

Modified:
    llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp

Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=344483&r1=344482&r2=344483&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Sun Oct 14 10:53:02 2018
@@ -4558,8 +4558,15 @@ Optional<unsigned> LoopVectorizationCost
   // If we optimize the program for size, avoid creating the tail loop.
   LLVM_DEBUG(dbgs() << "LV: Found trip count: " << TC << '\n');
 
+  if (TC == 1) {
+    ORE->emit(createMissedAnalysis("SingleIterationLoop")
+              << "loop trip count is one, irrelevant for vectorization");
+    LLVM_DEBUG(dbgs() << "LV: Aborting, single iteration (non) loop.\n");
+    return None;
+  }
+
   // If we don't know the precise trip count, don't try to vectorize.
-  if (TC < 2) {
+  if (TC == 0) {
     ORE->emit(
         createMissedAnalysis("UnknownLoopCountComplexCFG")
         << "unable to calculate the loop count due to complex control flow");




More information about the llvm-commits mailing list