[PATCH] D11892: LoopVersioning: Use default LAA runtimeCheck, When input check not provided.
Ashutosh Nema via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 9 22:44:55 PDT 2015
ashutosh.nema created this revision.
ashutosh.nema added a reviewer: anemet.
ashutosh.nema added a subscriber: llvm-commits.
ashutosh.nema set the repository for this revision to rL LLVM.
In this change enabled LoopVersioning utility to add runtime check
when input check is NULL. Earlier clients of loop versioning needs to
always pass runtime check. Now made this optional.
If user does not provide runtime check, LoopVersioning will use default
LoopAccessAnalysis runtime check.
Repository:
rL LLVM
http://reviews.llvm.org/D11892
Files:
include/llvm/Transforms/Utils/LoopVersioning.h
lib/Transforms/Scalar/LoopDistribute.cpp
lib/Transforms/Utils/LoopVersioning.cpp
Index: lib/Transforms/Utils/LoopVersioning.cpp
===================================================================
--- lib/Transforms/Utils/LoopVersioning.cpp
+++ lib/Transforms/Utils/LoopVersioning.cpp
@@ -23,11 +23,11 @@
using namespace llvm;
LoopVersioning::LoopVersioning(
- SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks,
const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI, DominatorTree *DT,
+ SmallVector<RuntimePointerChecking::PointerCheck, 4> *Checks,
const SmallVector<int, 8> *PtrToPartition)
- : VersionedLoop(L), NonVersionedLoop(nullptr), Checks(std::move(Checks)),
- LAI(LAI), LI(LI), DT(DT) {
+ : VersionedLoop(L), NonVersionedLoop(nullptr), LAI(LAI), LI(LI), DT(DT),
+ Checks(Checks) {
assert(L->getExitBlock() && "No single exit block");
assert(L->getLoopPreheader() && "No preheader");
}
@@ -38,7 +38,8 @@
// Add the memcheck in the original preheader (this is empty initially).
BasicBlock *MemCheckBB = VersionedLoop->getLoopPreheader();
std::tie(FirstCheckInst, MemRuntimeCheck) =
- LAI.addRuntimeCheck(MemCheckBB->getTerminator(), Checks);
+ Checks ? LAI.addRuntimeCheck(MemCheckBB->getTerminator(), *Checks)
+ : LAI.addRuntimeCheck(MemCheckBB->getTerminator());
assert(MemRuntimeCheck && "called even though needsAnyChecking = false");
// Rename the block to make the IR more readable.
Index: lib/Transforms/Scalar/LoopDistribute.cpp
===================================================================
--- lib/Transforms/Scalar/LoopDistribute.cpp
+++ lib/Transforms/Scalar/LoopDistribute.cpp
@@ -793,7 +793,7 @@
if (!Checks.empty()) {
DEBUG(dbgs() << "\nPointers:\n");
DEBUG(LAI.getRuntimePointerChecking()->printChecks(dbgs(), Checks));
- LoopVersioning LVer(std::move(Checks), LAI, L, LI, DT);
+ LoopVersioning LVer(LAI, L, LI, DT, &Checks);
LVer.versionLoop(this);
LVer.addPHINodes(DefsUsedOutside);
}
Index: include/llvm/Transforms/Utils/LoopVersioning.h
===================================================================
--- include/llvm/Transforms/Utils/LoopVersioning.h
+++ include/llvm/Transforms/Utils/LoopVersioning.h
@@ -31,10 +31,10 @@
/// already has a preheader.
class LoopVersioning {
public:
- LoopVersioning(SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks,
- const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI,
- DominatorTree *DT,
- const SmallVector<int, 8> *PtrToPartition = nullptr);
+ LoopVersioning(
+ const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI, DominatorTree *DT,
+ SmallVector<RuntimePointerChecking::PointerCheck, 4> *Checks = nullptr,
+ const SmallVector<int, 8> *PtrToPartition = nullptr);
/// \brief Performs the CFG manipulation part of versioning the loop including
/// the DominatorTree and LoopInfo updates.
@@ -80,13 +80,14 @@
/// in NonVersionedLoop.
ValueToValueMapTy VMap;
- /// \brief The set of checks that we are versioning for.
- SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks;
-
/// \brief Analyses used.
const LoopAccessInfo &LAI;
LoopInfo *LI;
DominatorTree *DT;
+
+ /// \brief The set of checks that we are versioning for.
+ SmallVector<RuntimePointerChecking::PointerCheck, 4> *Checks;
+
};
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11892.31634.patch
Type: text/x-patch
Size: 3338 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150810/8ddae15a/attachment.bin>
More information about the llvm-commits
mailing list