[PATCH] [LoopVectorize] Add accessors for Num{Stores, Loads, PredStores} in AccessAnalysis

Adam Nemet anemet at apple.com
Thu Jan 29 16:52:48 PST 2015


Hi hfinkel, aschwaighofer,

These members are moving to LoopAccessAnalysis.  The accessors help to hide
this.

NFC.  This is part of the patchset that splits out the memory dependence logic
from LoopVectorizationLegality into a new class LoopAccessAnalysis.
LoopAccessAnalysis will be used by the new Loop Distribution pass.

http://reviews.llvm.org/D7281

Files:
  lib/Transforms/Vectorize/LoopVectorize.cpp

Index: lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- lib/Transforms/Vectorize/LoopVectorize.cpp
+++ lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -622,10 +622,6 @@
 /// induction variable and the different reduction variables.
 class LoopVectorizationLegality {
 public:
-  unsigned NumLoads;
-  unsigned NumStores;
-  unsigned NumPredStores;
-
   LoopVectorizationLegality(Loop *L, ScalarEvolution *SE, const DataLayout *DL,
                             DominatorTree *DT, TargetLibraryInfo *TLI,
                             AliasAnalysis *AA, Function *F,
@@ -795,6 +791,15 @@
   bool isMaskRequired(const Instruction* I) {
     return (MaskedOp.count(I) != 0);
   }
+  unsigned getNumStores() const {
+    return NumStores;
+  }
+  unsigned getNumLoads() const {
+    return NumLoads;
+  }
+  unsigned getNumPredStores() const {
+    return NumPredStores;
+  }
 private:
   /// Check if a single basic block loop is vectorizable.
   /// At this point we know that this is a loop with a constant trip count
@@ -849,6 +854,10 @@
     emitLoopAnalysis(Message, TheFunction, TheLoop);
   }
 
+  unsigned NumLoads;
+  unsigned NumStores;
+  unsigned NumPredStores;
+
   /// The loop that we evaluate.
   Loop *TheLoop;
   /// Scev analysis.
@@ -5429,7 +5438,7 @@
     return Factor;
   }
 
-  if (!EnableCondStoresVectorization && Legal->NumPredStores) {
+  if (!EnableCondStoresVectorization && Legal->getNumPredStores()) {
     emitAnalysis(Report() << "store that is conditionally executed prevents vectorization");
     DEBUG(dbgs() << "LV: No vectorization. There are conditional stores.\n");
     return Factor;
@@ -5695,8 +5704,10 @@
 
     // Unroll until store/load ports (estimated by max unroll factor) are
     // saturated.
-    unsigned StoresUF = UF / (Legal->NumStores ? Legal->NumStores : 1);
-    unsigned LoadsUF = UF /  (Legal->NumLoads ? Legal->NumLoads : 1);
+    unsigned NumStores = Legal->getNumStores();
+    unsigned NumLoads = Legal->getNumLoads();
+    unsigned StoresUF = UF / (NumStores ? NumStores : 1);
+    unsigned LoadsUF = UF /  (NumLoads ? NumLoads : 1);
 
     // If we have a scalar reduction (vector reductions are already dealt with
     // by this point), we can increase the critical path length if the loop

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7281.19010.patch
Type: text/x-patch
Size: 2320 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150130/1f8aa327/attachment.bin>


More information about the llvm-commits mailing list