summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2015-02-18 03:43:58 +0000
committerAdam Nemet <anemet@apple.com>2015-02-18 03:43:58 +0000
commita8945b77909ba9871db030f94df50a7ca7f77731 (patch)
tree04cd38db457298d9bc48f32f74db1b319d2ee7f4 /llvm/lib
parentd0db4c1395234f9bcda3d6aa11994613af28533d (diff)
downloadbcm5719-llvm-a8945b77909ba9871db030f94df50a7ca7f77731.tar.gz
bcm5719-llvm-a8945b77909ba9871db030f94df50a7ca7f77731.zip
[LoopAccesses] Factor out RuntimePointerCheck::needsChecking
Will be used by the new RuntimePointerCheck::print. This is part of the patchset that converts LoopAccessAnalysis into an actual analysis pass. llvm-svn: 229629
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 4ccd135f894..e9e9be31ff7 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -93,6 +93,23 @@ void LoopAccessInfo::RuntimePointerCheck::insert(ScalarEvolution *SE, Loop *Lp,
AliasSetId.push_back(ASId);
}
+bool LoopAccessInfo::RuntimePointerCheck::needsChecking(unsigned I,
+ unsigned J) const {
+ // No need to check if two readonly pointers intersect.
+ if (!IsWritePtr[I] && !IsWritePtr[J])
+ return false;
+
+ // Only need to check pointers between two different dependency sets.
+ if (DependencySetId[I] == DependencySetId[J])
+ return false;
+
+ // Only need to check pointers in the same alias set.
+ if (AliasSetId[I] != AliasSetId[J])
+ return false;
+
+ return true;
+}
+
namespace {
/// \brief Analyses memory accesses in a loop.
///
@@ -1147,15 +1164,7 @@ LoopAccessInfo::addRuntimeCheck(Instruction *Loc) {
Value *MemoryRuntimeCheck = nullptr;
for (unsigned i = 0; i < NumPointers; ++i) {
for (unsigned j = i+1; j < NumPointers; ++j) {
- // No need to check if two readonly pointers intersect.
- if (!PtrRtCheck.IsWritePtr[i] && !PtrRtCheck.IsWritePtr[j])
- continue;
-
- // Only need to check pointers between two different dependency sets.
- if (PtrRtCheck.DependencySetId[i] == PtrRtCheck.DependencySetId[j])
- continue;
- // Only need to check pointers in the same alias set.
- if (PtrRtCheck.AliasSetId[i] != PtrRtCheck.AliasSetId[j])
+ if (!PtrRtCheck.needsChecking(i, j))
continue;
unsigned AS0 = Starts[i]->getType()->getPointerAddressSpace();
OpenPOWER on IntegriCloud