[polly] r261793 - Introduce ScopStmt::getRegionNode(). NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 14:08:29 PST 2016


Author: meinersbur
Date: Wed Feb 24 16:08:28 2016
New Revision: 261793

URL: http://llvm.org/viewvc/llvm-project?rev=261793&view=rev
Log:
Introduce ScopStmt::getRegionNode(). NFC.

Replace an inline ternary operator pattern.

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopInfo.cpp

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=261793&r1=261792&r2=261793&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Wed Feb 24 16:08:28 2016
@@ -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(); }
 

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=261793&r1=261792&r2=261793&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Feb 24 16:08:28 2016
@@ -1536,6 +1536,12 @@ BasicBlock *ScopStmt::getEntryBlock() co
   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 RemoveIgnor
                         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)




More information about the llvm-commits mailing list