[PATCH] D18324: [SLP] Simplify logic by using container APIs. NFC.

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 12:33:20 PDT 2016


mcrosier created this revision.
mcrosier added a reviewer: mssimpso.
mcrosier added a subscriber: llvm-commits.
Herald added a subscriber: mzolotukhin.

Please have a look.
 
Chad

http://reviews.llvm.org/D18324

Files:
  lib/Transforms/Vectorize/SLPVectorizer.cpp

Index: lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -3439,8 +3439,8 @@
       collectSeedInstructions(BB);
 
       // Vectorize trees that end at stores.
-      if (NumStores > 0) {
-        DEBUG(dbgs() << "SLP: Found " << NumStores << " stores.\n");
+      if (!Stores.empty()) {
+        DEBUG(dbgs() << "SLP: Found " << Stores.size() << " stores.\n");
         Changed |= vectorizeStoreChains(R);
       }
 
@@ -3450,8 +3450,8 @@
       // Vectorize the index computations of getelementptr instructions. This
       // is primarily intended to catch gather-like idioms ending at
       // non-consecutive loads.
-      if (NumGEPs > 0) {
-        DEBUG(dbgs() << "SLP: Found " << NumGEPs << " GEPs.\n");
+      if (!GEPs.empty()) {
+        DEBUG(dbgs() << "SLP: Found " << GEPs.size() << " GEPs.\n");
         Changed |= vectorizeGEPIndices(BB, R);
       }
     }
@@ -3527,12 +3527,6 @@
   /// The getelementptr instructions in a basic block organized by base pointer.
   WeakVHListMap GEPs;
 
-  /// The number of store instructions in a basic block.
-  unsigned NumStores;
-
-  /// The number of getelementptr instructions in a basic block.
-  unsigned NumGEPs;
-
   unsigned MaxVecRegSize; // This is set by TTI or overridden by cl::opt.
   unsigned MinVecRegSize; // Set by cl::opt (default: 128).
 };
@@ -3670,7 +3664,6 @@
   // Initialize the collections. We will make a single pass over the block.
   Stores.clear();
   GEPs.clear();
-  NumStores = NumGEPs = 0;
 
   // Visit the store and getelementptr instructions in BB and organize them in
   // Stores and GEPs according to the underlying objects of their pointer
@@ -3685,7 +3678,6 @@
       if (!isValidElementType(SI->getValueOperand()->getType()))
         continue;
       Stores[GetUnderlyingObject(SI->getPointerOperand(), *DL)].push_back(SI);
-      ++NumStores;
     }
 
     // Ignore getelementptr instructions that have more than one index, a
@@ -3698,7 +3690,6 @@
       if (!isValidElementType(Idx->getType()))
         continue;
       GEPs[GetUnderlyingObject(GEP->getPointerOperand(), *DL)].push_back(GEP);
-      ++NumGEPs;
     }
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18324.51213.patch
Type: text/x-patch
Size: 2289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160321/e27f63ac/attachment.bin>


More information about the llvm-commits mailing list