diff --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h index 25da9827eea2..c4a9dc42cc8f 100644 --- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h +++ b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h @@ -384,7 +384,7 @@ public: bool UseDependencies); /// \brief Returns the checks that generateChecks created. - const SmallVectorImpl &getChecks() const { return Checks; } + const SmallVector &getChecks() const { return Checks; } /// \brief Decide if we need to add a check between two groups of pointers, /// according to needsChecking. diff --git a/llvm/include/llvm/Transforms/Utils/LoopVersioning.h b/llvm/include/llvm/Transforms/Utils/LoopVersioning.h index d4932fc59462..4779b7ede2b4 100644 --- a/llvm/include/llvm/Transforms/Utils/LoopVersioning.h +++ b/llvm/include/llvm/Transforms/Utils/LoopVersioning.h @@ -31,10 +31,17 @@ class LoopInfo; /// 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 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 &LAInfo, Loop *L, LoopInfo *LI, + DominatorTree *DT); + /// \brief Performs the CFG manipulation part of versioning the loop including /// the DominatorTree and LoopInfo updates. /// diff --git a/llvm/lib/Transforms/Utils/LoopVersioning.cpp b/llvm/lib/Transforms/Utils/LoopVersioning.cpp index 4d2b1ee101fc..ad2de241b408 100644 --- a/llvm/lib/Transforms/Utils/LoopVersioning.cpp +++ b/llvm/lib/Transforms/Utils/LoopVersioning.cpp @@ -31,6 +31,15 @@ LoopVersioning::LoopVersioning( assert(L->getLoopPreheader() && "No preheader"); } +LoopVersioning::LoopVersioning(const LoopAccessInfo &LAInfo, Loop *L, + LoopInfo *LI, DominatorTree *DT) + : VersionedLoop(L), NonVersionedLoop(nullptr), + Checks(LAInfo.getRuntimePointerChecking()->getChecks()), LAI(LAInfo), + LI(LI), DT(DT) { + assert(L->getExitBlock() && "No single exit block"); + assert(L->getLoopPreheader() && "No preheader"); +} + void LoopVersioning::versionLoop(Pass *P) { Instruction *FirstCheckInst; Instruction *MemRuntimeCheck;