summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2015-12-16 16:14:00 +0000
committerTobias Grosser <tobias@grosser.es>2015-12-16 16:14:00 +0000
commit2ed317383b9ef7191134f907662463baeff629cf (patch)
treef4885ee7639f4dedc8a8d9e8b980c973963f44b5
parent271186bbb669dc52e946551fa5e3960fd0a8b621 (diff)
downloadbcm5719-llvm-2ed317383b9ef7191134f907662463baeff629cf.tar.gz
bcm5719-llvm-2ed317383b9ef7191134f907662463baeff629cf.zip
ScopInfo: Introduce getNumberOfArrayAccesses
Use the new function to clarify that we indeed only want to know it at least one array access is associated with an instruction. llvm-svn: 255776
-rw-r--r--polly/include/polly/ScopInfo.h23
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp2
2 files changed, 24 insertions, 1 deletions
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h
index 94d5ae93e27..1a920561fde 100644
--- a/polly/include/polly/ScopInfo.h
+++ b/polly/include/polly/ScopInfo.h
@@ -992,6 +992,29 @@ public:
return *ArrayAccess;
}
+ /// @brief Get the number of array accesses associated with an instruction.
+ ///
+ /// @param Inst The instruction for which to obtain the access count.
+ /// @returns The number of array accesses associated with this instruction.
+ size_t getNumberOfArrayAccessesFor(const Instruction *Inst) const {
+ size_t NumAccesses = 0;
+ auto It = InstructionToAccess.find(Inst);
+ if (It == InstructionToAccess.end())
+ return 0;
+
+ auto *Accesses = It->getSecond();
+
+ if (!Accesses)
+ return 0;
+
+ for (auto Access : *Accesses) {
+ if (Access->isArrayKind())
+ NumAccesses++;
+ }
+
+ return NumAccesses;
+ }
+
/// @brief Return the __first__ (scalar) memory access for @p Inst if any.
MemoryAccess *lookupAccessFor(const Instruction *Inst) const {
auto It = InstructionToAccess.find(Inst);
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index b24c1d31fb7..8209b5b5723 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -2923,7 +2923,7 @@ void Scop::verifyInvariantLoads() {
for (LoadInst *LI : RIL) {
assert(LI && getRegion().contains(LI));
ScopStmt *Stmt = getStmtForBasicBlock(LI->getParent());
- if (Stmt && Stmt->lookupAccessesFor(LI)) {
+ if (Stmt && Stmt->getNumberOfArrayAccessesFor(LI) > 0) {
invalidate(INVARIANTLOAD, LI->getDebugLoc());
return;
}
OpenPOWER on IntegriCloud