Introduce ScopStmt::getRegionNode(). NFC.

Replace an inline ternary operator pattern.

llvm-svn: 261793
This commit is contained in:
Michael Kruse 2016-02-24 22:08:28 +00:00
parent 375cb5fe0a
commit 7b5caa4a72
2 changed files with 11 additions and 3 deletions

View File

@ -1083,6 +1083,10 @@ public:
/// statements, return its entry block.
BasicBlock *getEntryBlock() const;
/// @brief Return RegionInfo's RegionNode for this statements' BB or
/// subregion.
RegionNode *getRegionNode() const;
/// @brief Return true if this statement does not contain any accesses.
bool isEmpty() const { return MemAccs.empty(); }

View File

@ -1536,6 +1536,12 @@ BasicBlock *ScopStmt::getEntryBlock() const {
return getRegion()->getEntry();
}
RegionNode *ScopStmt::getRegionNode() const {
if (isRegionStmt())
return getRegion()->getNode();
return getParent()->getRegion().getBBNode(getBasicBlock());
}
unsigned ScopStmt::getNumParams() const { return Parent.getNumParams(); }
unsigned ScopStmt::getNumIterators() const { return NestLoops.size(); }
@ -2875,9 +2881,7 @@ void Scop::simplifySCoP(bool RemoveIgnoredStmts, DominatorTree &DT,
LoopInfo &LI) {
for (auto StmtIt = Stmts.begin(), StmtEnd = Stmts.end(); StmtIt != StmtEnd;) {
ScopStmt &Stmt = *StmtIt;
RegionNode *RN = Stmt.isRegionStmt()
? Stmt.getRegion()->getNode()
: getRegion().getBBNode(Stmt.getBasicBlock());
RegionNode *RN = Stmt.getRegionNode();
bool RemoveStmt = StmtIt->isEmpty();
if (!RemoveStmt)