[LoopVer] Optionally allow using memchecks from LAA

r243382 changed the behavior to always require a set of memchecks to be
passed to LoopVer.  This change restores the prior behavior as an
alternative to the new behavior.  This allows the checks to be
implicitly taken from the LAA object.

Patch by Ashutosh Nema!

llvm-svn: 244763
This commit is contained in:
Adam Nemet 2015-08-12 16:51:19 +00:00
parent eb2bd9a269
commit dfaeb33ec7
3 changed files with 17 additions and 1 deletions

View File

@ -384,7 +384,7 @@ public:
bool UseDependencies); bool UseDependencies);
/// \brief Returns the checks that generateChecks created. /// \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, /// \brief Decide if we need to add a check between two groups of pointers,
/// according to needsChecking. /// according to needsChecking.

View File

@ -31,10 +31,17 @@ class LoopInfo;
/// already has a preheader. /// already has a preheader.
class LoopVersioning { class LoopVersioning {
public: public:
/// \brief Expects MemCheck, LoopAccessInfo, Loop, LoopInfo, DominatorTree
/// as input. It uses runtime check provided by user.
LoopVersioning(SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks, LoopVersioning(SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks,
const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI, const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI,
DominatorTree *DT); 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 /// \brief Performs the CFG manipulation part of versioning the loop including
/// the DominatorTree and LoopInfo updates. /// the DominatorTree and LoopInfo updates.
/// ///

View File

@ -31,6 +31,15 @@ LoopVersioning::LoopVersioning(
assert(L->getLoopPreheader() && "No preheader"); 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) { void LoopVersioning::versionLoop(Pass *P) {
Instruction *FirstCheckInst; Instruction *FirstCheckInst;
Instruction *MemRuntimeCheck; Instruction *MemRuntimeCheck;