Index: include/polly/ScopInfo.h =================================================================== --- include/polly/ScopInfo.h +++ include/polly/ScopInfo.h @@ -1661,8 +1661,9 @@ /// delete the last object that creates isl objects with the context. std::shared_ptr IslCtx; - /// A map from basic blocks to SCoP statements. - DenseMap StmtMap; + /// A map from basic blocks to vector of SCoP statements. Currently this + /// vector comprises only of a single statement. + DenseMap> StmtMap; /// A map from basic blocks to their domains. DenseMap DomainMap; Index: lib/Analysis/ScopInfo.cpp =================================================================== --- lib/Analysis/ScopInfo.cpp +++ lib/Analysis/ScopInfo.cpp @@ -4745,7 +4745,7 @@ 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) { @@ -4753,7 +4753,7 @@ 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, @@ -4905,7 +4905,8 @@ 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 {