summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2015-08-12 16:51:19 +0000
committerAdam Nemet <anemet@apple.com>2015-08-12 16:51:19 +0000
commitdfaeb33ec7dcef6389fa70af5d68006585ac8c65 (patch)
tree0b00dca9d44f62af0c0f54018d8555ad67446c3a /llvm
parenteb2bd9a2699188bdc25f19631497bee77f0c5949 (diff)
downloadbcm5719-llvm-dfaeb33ec7dcef6389fa70af5d68006585ac8c65.tar.gz
bcm5719-llvm-dfaeb33ec7dcef6389fa70af5d68006585ac8c65.zip
[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
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Analysis/LoopAccessAnalysis.h2
-rw-r--r--llvm/include/llvm/Transforms/Utils/LoopVersioning.h7
-rw-r--r--llvm/lib/Transforms/Utils/LoopVersioning.cpp9
3 files changed, 17 insertions, 1 deletions
diff --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
index 25da9827eea..c4a9dc42cc8 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<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.
diff --git a/llvm/include/llvm/Transforms/Utils/LoopVersioning.h b/llvm/include/llvm/Transforms/Utils/LoopVersioning.h
index d4932fc5946..4779b7ede2b 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<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 &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 4d2b1ee101f..ad2de241b40 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;
OpenPOWER on IntegriCloud