[LoopAccesses] Cache the result of canVectorizeMemory
[oota-llvm.git] / include / llvm / Analysis / LoopAccessAnalysis.h
index 98e9c91f64f917bb197d0a18f330b7b0486602d9..3867b896504b2e835e8cbf688bf994488b7d3425 100644 (file)
@@ -140,11 +140,14 @@ public:
                  const TargetLibraryInfo *TLI, AliasAnalysis *AA,
                  DominatorTree *DT) :
       TheLoop(L), SE(SE), DL(DL), TLI(TLI), AA(AA), DT(DT), NumLoads(0),
-      NumStores(0), MaxSafeDepDistBytes(-1U) {}
+      NumStores(0), MaxSafeDepDistBytes(-1U), CanVecMem(false) {}
+
+  /// \brief Analyze the loop.  Replaces symbolic strides using Strides.
+  void analyzeLoop(ValueToValueMap &Strides);
 
   /// Return true we can analyze the memory accesses in the loop and there are
-  /// no memory dependence cycles.  Replaces symbolic strides using Strides.
-  bool canVectorizeMemory(ValueToValueMap &Strides);
+  /// no memory dependence cycles.
+  bool canVectorizeMemory() { return CanVecMem; }
 
   RuntimePointerCheck *getRuntimePointerCheck() { return &PtrRtCheck; }
 
@@ -189,6 +192,9 @@ private:
 
   unsigned MaxSafeDepDistBytes;
 
+  /// \brief Cache the result of analyzeLoop.
+  bool CanVecMem;
+
   /// \brief The diagnostics report generated for the analysis.  E.g. why we
   /// couldn't analyze the loop.
   Optional<VectorizationReport> Report;