[LoopAccesses] Cache the result of canVectorizeMemory
[oota-llvm.git] / include / llvm / Analysis / LoopAccessAnalysis.h
index 93ee959bfa7e4a9e811a274506901af63998526e..0cdde4c25647bfc3c838eeb2ff7303917eacb426 100644 (file)
@@ -134,11 +134,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; }
 
@@ -182,6 +185,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;