[llvm] r290142 - [LV] Sink tripcount query to where it's actually used. NFC.

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 14:47:52 PST 2016


Author: mkuper
Date: Mon Dec 19 16:47:52 2016
New Revision: 290142

URL: http://llvm.org/viewvc/llvm-project?rev=290142&view=rev
Log:
[LV] Sink tripcount query to where it's actually used. NFC.

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=290142&r1=290141&r2=290142&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Mon Dec 19 16:47:52 2016
@@ -6089,10 +6089,6 @@ LoopVectorizationCostModel::selectVector
     return Factor;
   }
 
-  // Find the trip count.
-  unsigned TC = PSE.getSE()->getSmallConstantTripCount(TheLoop);
-  DEBUG(dbgs() << "LV: Found trip count: " << TC << '\n');
-
   MinBWs = computeMinimumValueSizes(TheLoop->getBlocks(), *DB, &TTI);
   unsigned SmallestType, WidestType;
   std::tie(SmallestType, WidestType) = getSmallestAndWidestTypes();
@@ -6150,7 +6146,10 @@ LoopVectorizationCostModel::selectVector
 
   // If we optimize the program for size, avoid creating the tail loop.
   if (OptForSize) {
-    // If we are unable to calculate the trip count then don't try to vectorize.
+    unsigned TC = PSE.getSE()->getSmallConstantTripCount(TheLoop);
+    DEBUG(dbgs() << "LV: Found trip count: " << TC << '\n');
+
+    // If we don't know the precise trip count, don't try to vectorize.
     if (TC < 2) {
       ORE->emit(
           createMissedAnalysis("UnknownLoopCountComplexCFG")




More information about the llvm-commits mailing list