[PATCH] D11892: LoopVersioning: Use default LAA runtimeCheck, When input check not provided.

Ashutosh Nema via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 21:03:56 PDT 2015


ashutosh.nema updated this revision to Diff 31901.
ashutosh.nema added a comment.

Incorporated comments from Adam.


Repository:
  rL LLVM

http://reviews.llvm.org/D11892

Files:
  include/llvm/Analysis/LoopAccessAnalysis.h
  include/llvm/Transforms/Utils/LoopVersioning.h
  lib/Transforms/Utils/LoopVersioning.cpp

Index: lib/Transforms/Utils/LoopVersioning.cpp
===================================================================
--- lib/Transforms/Utils/LoopVersioning.cpp
+++ lib/Transforms/Utils/LoopVersioning.cpp
@@ -25,8 +25,16 @@
 LoopVersioning::LoopVersioning(
     SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks,
     const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI, DominatorTree *DT)
-    : VersionedLoop(L), NonVersionedLoop(nullptr), Checks(std::move(Checks)),
-      LAI(LAI), LI(LI), DT(DT) {
+    : VersionedLoop(L), NonVersionedLoop(nullptr), LAI(LAI),
+      Checks(std::move(Checks)), LI(LI), DT(DT) {
+  assert(L->getExitBlock() && "No single exit block");
+  assert(L->getLoopPreheader() && "No preheader");
+}
+
+LoopVersioning::LoopVersioning(const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI,
+                               DominatorTree *DT)
+    : VersionedLoop(L), NonVersionedLoop(nullptr), LAI(LAI),
+      Checks(LAI.getRuntimePointerChecking()->getChecks()), LI(LI), DT(DT) {
   assert(L->getExitBlock() && "No single exit block");
   assert(L->getLoopPreheader() && "No preheader");
 }
Index: include/llvm/Transforms/Utils/LoopVersioning.h
===================================================================
--- include/llvm/Transforms/Utils/LoopVersioning.h
+++ include/llvm/Transforms/Utils/LoopVersioning.h
@@ -31,10 +31,17 @@
 /// already has a preheader.
 class LoopVersioning {
 public:
+  /// \brief Expects MemCheck, LoopAccessInfo, Loop, LoopInfo, DominatorTree 
+  /// as input. It uses runtime check provided by user.
   LoopVersioning(SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks,
                  const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI,
                  DominatorTree *DT);
 
+  /// \brief Expects LoopAccessInfo, Loop, LoopInfo, DominatorTree as input.
+  /// It uses default runtime check provided by LoopAccessInfo.
+  LoopVersioning(const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI,
+                 DominatorTree *DT);
+
   /// \brief Performs the CFG manipulation part of versioning the loop including
   /// the DominatorTree and LoopInfo updates.
   ///
@@ -79,12 +86,16 @@
   /// in NonVersionedLoop.
   ValueToValueMapTy VMap;
 
+  /// \brief LoopAccessInfo for loop.
+  const LoopAccessInfo &LAI;
+
   /// \brief The set of checks that we are versioning for.
   SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks;
 
-  /// \brief Analyses used.
-  const LoopAccessInfo &LAI;
+  /// \brief Loop Info.
   LoopInfo *LI;
+
+  /// \brief Dominator Tree.
   DominatorTree *DT;
 };
 }
Index: include/llvm/Analysis/LoopAccessAnalysis.h
===================================================================
--- include/llvm/Analysis/LoopAccessAnalysis.h
+++ include/llvm/Analysis/LoopAccessAnalysis.h
@@ -384,7 +384,7 @@
                       bool UseDependencies);
 
   /// \brief Returns the checks that generateChecks created.
-  const SmallVectorImpl<PointerCheck> &getChecks() const { return Checks; }
+  const SmallVector<PointerCheck, 4> &getChecks() const { return Checks; }
 
   /// \brief Decide if we need to add a check between two groups of pointers,
   /// according to needsChecking.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11892.31901.patch
Type: text/x-patch
Size: 3182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150812/86af18db/attachment.bin>


More information about the llvm-commits mailing list