aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2015-07-27 19:38:48 +0000
committerAdam Nemet <anemet@apple.com>2015-07-27 19:38:48 +0000
commitbbe1f1de16ced33763fc13523870834f1269f1d9 (patch)
treed729e6be393d6f3ec721e7d023373e794496398e /llvm/lib/Analysis/LoopAccessAnalysis.cpp
parenta99369862d358753c1655283f24e72fa26a8d837 (diff)
downloadllvm-bbe1f1de16ced33763fc13523870834f1269f1d9.zip
llvm-bbe1f1de16ced33763fc13523870834f1269f1d9.tar.gz
llvm-bbe1f1de16ced33763fc13523870834f1269f1d9.tar.bz2
[LAA] Split out a helper from addRuntimeCheck to generate the check, NFC
llvm-svn: 243312
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 7fe2c99..48f2379 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -148,6 +148,23 @@ void RuntimePointerChecking::insert(Loop *Lp, Value *Ptr, bool WritePtr,
Pointers.emplace_back(Ptr, ScStart, ScEnd, WritePtr, DepSetId, ASId, Sc);
}
+SmallVector<RuntimePointerChecking::PointerCheck, 4>
+RuntimePointerChecking::generateChecks(
+ const SmallVectorImpl<int> *PtrPartition) const {
+ SmallVector<PointerCheck, 4> Checks;
+
+ for (unsigned i = 0; i < CheckingGroups.size(); ++i) {
+ for (unsigned j = i + 1; j < CheckingGroups.size(); ++j) {
+ const RuntimePointerChecking::CheckingPtrGroup &CGI = CheckingGroups[i];
+ const RuntimePointerChecking::CheckingPtrGroup &CGJ = CheckingGroups[j];
+
+ if (needsChecking(CGI, CGJ, PtrPartition))
+ Checks.push_back(std::make_pair(&CGI, &CGJ));
+ }
+ }
+ return Checks;
+}
+
bool RuntimePointerChecking::needsChecking(
const CheckingPtrGroup &M, const CheckingPtrGroup &N,
const SmallVectorImpl<int> *PtrPartition) const {
@@ -1708,20 +1725,7 @@ std::pair<Instruction *, Instruction *> LoopAccessInfo::addRuntimeCheck(
if (!PtrRtChecking.Need)
return std::make_pair(nullptr, nullptr);
- SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks;
- for (unsigned i = 0; i < PtrRtChecking.CheckingGroups.size(); ++i) {
- for (unsigned j = i + 1; j < PtrRtChecking.CheckingGroups.size(); ++j) {
- const RuntimePointerChecking::CheckingPtrGroup &CGI =
- PtrRtChecking.CheckingGroups[i];
- const RuntimePointerChecking::CheckingPtrGroup &CGJ =
- PtrRtChecking.CheckingGroups[j];
-
- if (PtrRtChecking.needsChecking(CGI, CGJ, PtrPartition))
- Checks.push_back(std::make_pair(&CGI, &CGJ));
- }
- }
-
- return addRuntimeCheck(Loc, Checks);
+ return addRuntimeCheck(Loc, PtrRtChecking.generateChecks(PtrPartition));
}
LoopAccessInfo::LoopAccessInfo(Loop *L, ScalarEvolution *SE,