forked from OSchip/llvm-project
[ScopInfo] Allow epilogues to be the main statement of a BB.
Do not add a "_last" suffix to the statement name if there is no (other) main statement for a basic block. In other words, it becomes the main statement itself. This further reduces the statement naming difference between -polly-stmt-granularity=bb and -polly-stmt-granularity=scalar-indep. llvm-svn: 324168
This commit is contained in:
parent
393dfc468d
commit
217704f7a8
|
@ -856,6 +856,7 @@ void ScopBuilder::buildEqivClassBlockStmts(BasicBlock *BB) {
|
|||
// Finally build the statements.
|
||||
int Count = 0;
|
||||
long BBIdx = scop->getNextStmtIdx();
|
||||
bool MainFound = false;
|
||||
for (auto &Instructions : reverse(LeaderToInstList)) {
|
||||
std::vector<Instruction *> &InstList = Instructions.second;
|
||||
|
||||
|
@ -866,6 +867,8 @@ void ScopBuilder::buildEqivClassBlockStmts(BasicBlock *BB) {
|
|||
InstList.end();
|
||||
else
|
||||
IsMain = (Count == 0);
|
||||
if (IsMain)
|
||||
MainFound = true;
|
||||
|
||||
std::reverse(InstList.begin(), InstList.end());
|
||||
std::string Name = makeStmtName(BB, BBIdx, Count, IsMain);
|
||||
|
@ -877,7 +880,7 @@ void ScopBuilder::buildEqivClassBlockStmts(BasicBlock *BB) {
|
|||
// instructions, but holds the PHI write accesses for successor basic blocks,
|
||||
// if the incoming value is not defined in another statement if the same BB.
|
||||
// The epilogue will be removed if no PHIWrite is added to it.
|
||||
std::string EpilogueName = makeStmtName(BB, BBIdx, Count, false, true);
|
||||
std::string EpilogueName = makeStmtName(BB, BBIdx, Count, !MainFound, true);
|
||||
scop->addScopStmt(BB, EpilogueName, L, {});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue