summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2015-12-13 19:21:45 +0000
committerMichael Kruse <llvm@meinersbur.de>2015-12-13 19:21:45 +0000
commita902ba6f1eb8ec7bcc651fc43c5b8ed9cd87f09d (patch)
treef88a6643b655e245f0599b185b1679013498ae70
parente3ec4563b2c2c6a4447d12e06aca779ccf8d1d01 (diff)
downloadbcm5719-llvm-a902ba6f1eb8ec7bcc651fc43c5b8ed9cd87f09d.tar.gz
bcm5719-llvm-a902ba6f1eb8ec7bcc651fc43c5b8ed9cd87f09d.zip
Reuse ScopStmt::isEmpty() function
Introduce a function getStmtForRegionNode() to the corresponding ScopStmt of a RegionNode. We can use it to call the existing ScopStmt::isEmpty() function instead of searching for accesses. llvm-svn: 255465
-rw-r--r--polly/include/polly/ScopInfo.h5
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp17
2 files changed, 15 insertions, 7 deletions
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h
index d8c7c93c600..07ab57a6630 100644
--- a/polly/include/polly/ScopInfo.h
+++ b/polly/include/polly/ScopInfo.h
@@ -1575,6 +1575,11 @@ public:
/// @brief Return the stmt for the given @p BB or nullptr if none.
ScopStmt *getStmtForBasicBlock(BasicBlock *BB) const;
+ /// @brief Return the ScopStmt that represents @p RN; can return nullptr if
+ /// the RegionNode is not within the SCoP or has been removed due to
+ /// simplifications.
+ ScopStmt *getStmtForRegionNode(RegionNode *RN) const;
+
/// @brief Return the number of statements in the SCoP.
size_t getSize() const { return Stmts.size(); }
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 7e236f6c20e..9d7a4339a92 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -3318,15 +3318,14 @@ ScalarEvolution *Scop::getSE() const { return SE; }
bool Scop::isIgnored(RegionNode *RN) {
BasicBlock *BB = getRegionNodeBasicBlock(RN);
+ ScopStmt *Stmt = getStmtForRegionNode(RN);
+
+ // If there is no stmt, then it already has been removed.
+ if (!Stmt)
+ return true;
// Check if there are accesses contained.
- bool ContainsAccesses = false;
- if (!RN->isSubRegion())
- ContainsAccesses = getAccessFunctions(BB);
- else
- for (BasicBlock *RBB : RN->getNodeAs<Region>()->blocks())
- ContainsAccesses |= (getAccessFunctions(RBB) != nullptr);
- if (!ContainsAccesses)
+ if (Stmt->isEmpty())
return true;
// Check for reachability via non-error blocks.
@@ -3491,6 +3490,10 @@ ScopStmt *Scop::getStmtForBasicBlock(BasicBlock *BB) const {
return StmtMapIt->second;
}
+ScopStmt *Scop::getStmtForRegionNode(RegionNode *RN) const {
+ return getStmtForBasicBlock(getRegionNodeBasicBlock(RN));
+}
+
int Scop::getRelativeLoopDepth(const Loop *L) const {
Loop *OuterLoop =
L ? R.outermostLoopInRegion(const_cast<Loop *>(L)) : nullptr;
OpenPOWER on IntegriCloud