[polly] r308318 - [ScopInfo] Introduce list of statements in Scop::StmtMap. NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 08:41:49 PDT 2017


Author: meinersbur
Date: Tue Jul 18 08:41:49 2017
New Revision: 308318

URL: http://llvm.org/viewvc/llvm-project?rev=308318&view=rev
Log:
[ScopInfo] Introduce list of statements in Scop::StmtMap. NFC.

Once statements are split, a BasicBlock will comprise of multiple
statements. To prepare for this change in future, we introduce a list
of statements in the statement map.

Contributed-by: Nandini Singhal <cs15mtech01004 at iith.ac.in>

Differential Revision: https://reviews.llvm.org/D35301

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=308318&r1=308317&r2=308318&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Tue Jul 18 08:41:49 2017
@@ -1670,8 +1670,9 @@ private:
   /// delete the last object that creates isl objects with the context.
   std::shared_ptr<isl_ctx> IslCtx;
 
-  /// A map from basic blocks to SCoP statements.
-  DenseMap<BasicBlock *, ScopStmt *> StmtMap;
+  /// A map from basic blocks to vector of SCoP statements. Currently this
+  /// vector comprises only of a single statement.
+  DenseMap<BasicBlock *, std::vector<ScopStmt *>> StmtMap;
 
   /// A map from basic blocks to their domains.
   DenseMap<BasicBlock *, isl::set> DomainMap;

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=308318&r1=308317&r2=308318&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Tue Jul 18 08:41:49 2017
@@ -4748,7 +4748,7 @@ void Scop::addScopStmt(BasicBlock *BB, L
   assert(BB && "Unexpected nullptr!");
   Stmts.emplace_back(*this, *BB, SurroundingLoop, Instructions);
   auto *Stmt = &Stmts.back();
-  StmtMap[BB] = Stmt;
+  StmtMap[BB].push_back(Stmt);
 }
 
 void Scop::addScopStmt(Region *R, Loop *SurroundingLoop) {
@@ -4756,7 +4756,7 @@ void Scop::addScopStmt(Region *R, Loop *
   Stmts.emplace_back(*this, *R, SurroundingLoop);
   auto *Stmt = &Stmts.back();
   for (BasicBlock *BB : R->blocks())
-    StmtMap[BB] = Stmt;
+    StmtMap[BB].push_back(Stmt);
 }
 
 ScopStmt *Scop::addScopStmt(__isl_take isl_map *SourceRel,
@@ -4908,7 +4908,8 @@ ScopStmt *Scop::getStmtFor(BasicBlock *B
   auto StmtMapIt = StmtMap.find(BB);
   if (StmtMapIt == StmtMap.end())
     return nullptr;
-  return StmtMapIt->second;
+  assert(StmtMapIt->second.size() == 1);
+  return StmtMapIt->second.front();
 }
 
 ScopStmt *Scop::getStmtFor(RegionNode *RN) const {




More information about the llvm-commits mailing list