Split ScopInfo::addScopStmt into two versions. NFC
authorHongbin Zheng <etherzhhb@gmail.com>
Mon, 21 Nov 2016 20:09:40 +0000 (20:09 +0000)
committerHongbin Zheng <etherzhhb@gmail.com>
Mon, 21 Nov 2016 20:09:40 +0000 (20:09 +0000)
One for adding statement for region, another one for BB

llvm-svn: 287566

polly/include/polly/ScopInfo.h
polly/lib/Analysis/ScopBuilder.cpp
polly/lib/Analysis/ScopInfo.cpp

index 4e92cbf..0a512ac 100644 (file)
@@ -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.
   ///
index 4e76d5d..7c45aa9 100644 (file)
@@ -430,7 +430,7 @@ void ScopBuilder::buildAccessFunctions(Region &SR) {
 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,
index fb21ba4..38daef3 100644 (file)
@@ -4206,18 +4206,19 @@ mapToDimension(__isl_take isl_union_set *USet, int N) {
   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,