[ScopBuilder] Introduce metadata for splitting scop statement.
This patch allows annotating of metadata in ir instruction
(with "polly_split_after"), which specifies where to split a particular
scop statement.
Contributed-by: Nandini Singhal <cs15mtech01004@iith.ac.in>
Differential Revision: https://reviews.llvm.org/D36402
llvm-svn: 312107
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index 55eef18..24ab38b 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -1764,11 +1764,14 @@
}
ScopStmt::ScopStmt(Scop &parent, BasicBlock &bb, Loop *SurroundingLoop,
- std::vector<Instruction *> Instructions)
+ std::vector<Instruction *> Instructions, int Count)
: Parent(parent), InvalidDomain(nullptr), Domain(nullptr), BB(&bb),
Build(nullptr), SurroundingLoop(SurroundingLoop),
Instructions(Instructions) {
- BaseName = getIslCompatibleName("Stmt", &bb, parent.getNextStmtIdx(), "",
+ std::string S = "";
+ if (Count != 0)
+ S += std::to_string(Count);
+ BaseName = getIslCompatibleName("Stmt", &bb, parent.getNextStmtIdx(), S,
UseInstructionNames);
}
@@ -4880,9 +4883,9 @@
}
void Scop::addScopStmt(BasicBlock *BB, Loop *SurroundingLoop,
- std::vector<Instruction *> Instructions) {
+ std::vector<Instruction *> Instructions, int Count) {
assert(BB && "Unexpected nullptr!");
- Stmts.emplace_back(*this, *BB, SurroundingLoop, Instructions);
+ Stmts.emplace_back(*this, *BB, SurroundingLoop, Instructions, Count);
auto *Stmt = &Stmts.back();
StmtMap[BB].push_back(Stmt);
for (Instruction *Inst : Instructions) {
@@ -5049,8 +5052,6 @@
auto StmtMapIt = StmtMap.find(BB);
if (StmtMapIt == StmtMap.end())
return {};
- assert(StmtMapIt->second.size() == 1 &&
- "Each statement corresponds to exactly one BB.");
return StmtMapIt->second;
}