[polly] r287566 - Split ScopInfo::addScopStmt into two versions. NFC

Hongbin Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 12:09:40 PST 2016


Author: ether
Date: Mon Nov 21 14:09:40 2016
New Revision: 287566

URL: http://llvm.org/viewvc/llvm-project?rev=287566&view=rev
Log:
Split ScopInfo::addScopStmt into two versions. NFC

One for adding statement for region, another one for BB

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/Analysis/ScopBuilder.cpp
    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=287566&r1=287565&r2=287566&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Mon Nov 21 14:09:40 2016
@@ -1858,14 +1858,21 @@ private:
   /// @return The representing SCEV for invariant loads or @p S if none.
   const SCEV *getRepresentingInvariantLoadSCEV(const SCEV *S);
 
-  /// Create a new SCoP statement for either @p BB or @p R.
+  /// Create a new SCoP statement for either @p BB.
   ///
-  /// Either @p BB or @p R should be non-null. A new statement for the non-null
-  /// argument will be created and added to the statement vector and map.
+  /// A new statement for @p BB will be created and added to the statement vector
+  /// and map.
   ///
-  /// @param BB         The basic block we build the statement for (or null)
-  /// @param R          The region we build the statement for (or null).
-  void addScopStmt(BasicBlock *BB, Region *R);
+  /// @param BB         The basic block we build the statement for.
+  void addScopStmt(BasicBlock *BB);
+
+  /// Create a new SCoP statement for either @p R.
+  ///
+  /// A new statement for @p R will be created and added to the statement vector
+  /// and map.
+  ///
+  /// @param R          The region we build the statement for.
+  void addScopStmt(Region *R);
 
   /// @param Update access dimensionalities.
   ///

Modified: polly/trunk/lib/Analysis/ScopBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopBuilder.cpp?rev=287566&r1=287565&r2=287566&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopBuilder.cpp (original)
+++ polly/trunk/lib/Analysis/ScopBuilder.cpp Mon Nov 21 14:09:40 2016
@@ -430,7 +430,7 @@ void ScopBuilder::buildAccessFunctions(R
 void ScopBuilder::buildStmts(Region &SR) {
 
   if (scop->isNonAffineSubRegion(&SR)) {
-    scop->addScopStmt(nullptr, &SR);
+    scop->addScopStmt(&SR);
     return;
   }
 
@@ -438,7 +438,7 @@ void ScopBuilder::buildStmts(Region &SR)
     if (I->isSubRegion())
       buildStmts(*I->getNodeAs<Region>());
     else
-      scop->addScopStmt(I->getNodeAs<BasicBlock>(), nullptr);
+      scop->addScopStmt(I->getNodeAs<BasicBlock>());
 }
 
 void ScopBuilder::buildAccessFunctions(BasicBlock &BB,

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=287566&r1=287565&r2=287566&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Nov 21 14:09:40 2016
@@ -4206,18 +4206,19 @@ mapToDimension(__isl_take isl_union_set
   return isl_multi_union_pw_aff_from_union_pw_multi_aff(Data.Res);
 }
 
-void Scop::addScopStmt(BasicBlock *BB, Region *R) {
-  if (BB) {
-    Stmts.emplace_back(*this, *BB);
-    auto *Stmt = &Stmts.back();
+void Scop::addScopStmt(BasicBlock *BB) {
+  assert(BB && "Unexpected nullptr!");
+  Stmts.emplace_back(*this, *BB);
+  auto *Stmt = &Stmts.back();
+  StmtMap[BB] = Stmt;
+}
+
+void Scop::addScopStmt(Region *R) {
+  assert(R && "Unexpected nullptr!");
+  Stmts.emplace_back(*this, *R);
+  auto *Stmt = &Stmts.back();
+  for (BasicBlock *BB : R->blocks())
     StmtMap[BB] = Stmt;
-  } else {
-    assert(R && "Either basic block or a region expected.");
-    Stmts.emplace_back(*this, *R);
-    auto *Stmt = &Stmts.back();
-    for (BasicBlock *BB : R->blocks())
-      StmtMap[BB] = Stmt;
-  }
 }
 
 ScopStmt *Scop::addScopStmt(__isl_take isl_map *SourceRel,




More information about the llvm-commits mailing list