diff options
-rw-r--r-- | polly/include/polly/ScopInfo.h | 5 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 17 |
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; |