summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2017-07-20 17:08:50 +0000
committerMichael Kruse <llvm@meinersbur.de>2017-07-20 17:08:50 +0000
commit6eba4b1031a2d55509076ceb840a9dba908a862f (patch)
tree65b1d0cecd976c05e1124ee069e87364e05693c8 /polly/lib/Analysis
parentc4d8f9b11a5f4ddd1e531de5cbc0745d5c8b5949 (diff)
downloadbcm5719-llvm-6eba4b1031a2d55509076ceb840a9dba908a862f.tar.gz
bcm5719-llvm-6eba4b1031a2d55509076ceb840a9dba908a862f.zip
[ScopInfo] Remove dependency of Scop::getLastStmtFor(BB) on getStmtFor(BB). NFC.
We are working towards removing uses of Scop::getStmtFor(BB). In this patch, we remove dependency of Scop::getLastStmtFor(BB) on getStmtFor(BB). To do so, we get the list of all statements corresponding to the BB and then fetch the last one. Contributed-by: Nandini Singhal <cs15mtech01004@iith.ac.in> Differential Revision: https://reviews.llvm.org/D35665 llvm-svn: 308633
Diffstat (limited to 'polly/lib/Analysis')
-rw-r--r--polly/lib/Analysis/ScopInfo.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 80286cfcdb8..49f29613654 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -4979,6 +4979,22 @@ ScopStmt *Scop::getStmtFor(BasicBlock *BB) const {
return StmtMapIt->second.front();
}
+ArrayRef<ScopStmt *> Scop::getStmtListFor(BasicBlock *BB) const {
+ auto StmtMapIt = StmtMap.find(BB);
+ if (StmtMapIt == StmtMap.end())
+ return {};
+ assert(StmtMapIt->second.size() == 1 &&
+ "Each statement corresponds to exactly one BB.");
+ return StmtMapIt->second;
+}
+
+ScopStmt *Scop::getLastStmtFor(BasicBlock *BB) const {
+ ArrayRef<ScopStmt *> StmtList = getStmtListFor(BB);
+ if (StmtList.size() > 0)
+ return StmtList.back();
+ return nullptr;
+}
+
ScopStmt *Scop::getStmtFor(RegionNode *RN) const {
if (RN->isSubRegion())
return getStmtFor(RN->getNodeAs<Region>());
OpenPOWER on IntegriCloud