[PATCH] D35665: [Polly] Remove dependency of `Scop::getLastStmtFor(BB)` on `getStmtFor(BB)`. [NFC].
Nandini Singhal via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 20 08:25:58 PDT 2017
nandini12396 updated this revision to Diff 107508.
nandini12396 added a comment.
Addressed comments.
https://reviews.llvm.org/D35665
Files:
include/polly/ScopInfo.h
lib/Analysis/ScopInfo.cpp
Index: lib/Analysis/ScopInfo.cpp
===================================================================
--- lib/Analysis/ScopInfo.cpp
+++ lib/Analysis/ScopInfo.cpp
@@ -4982,6 +4982,22 @@
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>());
Index: include/polly/ScopInfo.h
===================================================================
--- include/polly/ScopInfo.h
+++ include/polly/ScopInfo.h
@@ -2625,13 +2625,16 @@
/// none.
ScopStmt *getStmtFor(BasicBlock *BB) const;
+ /// Return the list of ScopStmts that represent the given @p BB.
+ ArrayRef<ScopStmt *> getStmtListFor(BasicBlock *BB) const;
+
/// Return the last statement representing @p BB.
///
/// Of the sequence of statements that represent a @p BB, this is the last one
/// to be executed. It is typically used to determine which instruction to add
/// a MemoryKind::PHI WRITE to. For this purpose, it is not strictly required
/// to be executed last, only that the incoming value is available in it.
- ScopStmt *getLastStmtFor(BasicBlock *BB) const { return getStmtFor(BB); }
+ ScopStmt *getLastStmtFor(BasicBlock *BB) const;
/// Return the ScopStmt that represents the Region @p R, or nullptr if
/// it is not represented by any statement in this Scop.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35665.107508.patch
Type: text/x-patch
Size: 1874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170720/cb9d4cb4/attachment.bin>
More information about the llvm-commits
mailing list