LoopVersioning::LoopVersioning(
SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks,
- const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI, DominatorTree *DT,
- const SmallVector<int, 8> *PtrToPartition)
- : VersionedLoop(L), NonVersionedLoop(nullptr),
- PtrToPartition(PtrToPartition), Checks(std::move(Checks)), LAI(LAI),
- LI(LI), DT(DT) {
+ const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI, DominatorTree *DT)
+ : VersionedLoop(L), NonVersionedLoop(nullptr), Checks(std::move(Checks)),
+ LAI(LAI), LI(LI), DT(DT) {
assert(L->getExitBlock() && "No single exit block");
assert(L->getLoopPreheader() && "No preheader");
}
-bool LoopVersioning::needsRuntimeChecks() const {
- return LAI.getRuntimePointerChecking()->needsAnyChecking(PtrToPartition);
+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() {
Instruction *FirstCheckInst;
Instruction *MemRuntimeCheck;
// Add the memcheck in the original preheader (this is empty initially).
BasicBlock *MemCheckBB = VersionedLoop->getLoopPreheader();
std::tie(FirstCheckInst, MemRuntimeCheck) =
- LAI.addRuntimeCheck(MemCheckBB->getTerminator(), Checks);
+ LAI.addRuntimeChecks(MemCheckBB->getTerminator(), Checks);
assert(MemRuntimeCheck && "called even though needsAnyChecking = false");
// Rename the block to make the IR more readable.