[PATCH] D35665: [Polly] Remove dependency of `Scop::getLastStmtFor(BB)` on `getStmtFor(BB)`. [NFC].
Michael Kruse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 20 10:12:11 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL308633: [ScopInfo] Remove dependency of Scop::getLastStmtFor(BB) on getStmtFor(BB). NFC. (authored by Meinersbur).
Changed prior to commit:
https://reviews.llvm.org/D35665?vs=107508&id=107541#toc
Repository:
rL LLVM
https://reviews.llvm.org/D35665
Files:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/ScopInfo.cpp
Index: polly/trunk/include/polly/ScopInfo.h
===================================================================
--- polly/trunk/include/polly/ScopInfo.h
+++ polly/trunk/include/polly/ScopInfo.h
@@ -2667,13 +2667,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.
Index: polly/trunk/lib/Analysis/ScopInfo.cpp
===================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp
+++ polly/trunk/lib/Analysis/ScopInfo.cpp
@@ -4979,6 +4979,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>());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35665.107541.patch
Type: text/x-patch
Size: 1946 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170720/e4395556/attachment.bin>
More information about the llvm-commits
mailing list