[ScopBuilder] Report to dbgs() on SCoP bailout. NFC.

This allows to use -debug to see that a SCoP was found in ScopDetect,
but dismissed by ScopBuilder.

llvm-svn: 312113
This commit is contained in:
Michael Kruse 2017-08-30 11:52:03 +00:00
parent db68911b07
commit 860870b7b0
2 changed files with 18 additions and 5 deletions

View File

@ -1017,8 +1017,10 @@ void ScopBuilder::buildScop(Region &R, AssumptionCache &AC,
/// A map from basic blocks to their invalid domains. /// A map from basic blocks to their invalid domains.
DenseMap<BasicBlock *, isl::set> InvalidDomainMap; DenseMap<BasicBlock *, isl::set> InvalidDomainMap;
if (!scop->buildDomains(&R, DT, LI, InvalidDomainMap)) if (!scop->buildDomains(&R, DT, LI, InvalidDomainMap)) {
DEBUG(dbgs() << "Bailing-out because buildDomains encountered problems\n");
return; return;
}
scop->addUserAssumptions(AC, DT, LI, InvalidDomainMap); scop->addUserAssumptions(AC, DT, LI, InvalidDomainMap);
@ -1034,21 +1036,26 @@ void ScopBuilder::buildScop(Region &R, AssumptionCache &AC,
// Exit early in case there are no executable statements left in this scop. // Exit early in case there are no executable statements left in this scop.
scop->removeStmtNotInDomainMap(); scop->removeStmtNotInDomainMap();
scop->simplifySCoP(false); scop->simplifySCoP(false);
if (scop->isEmpty()) if (scop->isEmpty()) {
DEBUG(dbgs() << "Bailing-out because SCoP is empty\n");
return; return;
}
// The ScopStmts now have enough information to initialize themselves. // The ScopStmts now have enough information to initialize themselves.
for (ScopStmt &Stmt : *scop) for (ScopStmt &Stmt : *scop)
Stmt.init(LI); Stmt.init(LI);
// Check early for a feasible runtime context. // Check early for a feasible runtime context.
if (!scop->hasFeasibleRuntimeContext()) if (!scop->hasFeasibleRuntimeContext()) {
DEBUG(dbgs() << "Bailing-out because of unfeasible context (early)\n");
return; return;
}
// Check early for profitability. Afterwards it cannot change anymore, // Check early for profitability. Afterwards it cannot change anymore,
// only the runtime context could become infeasible. // only the runtime context could become infeasible.
if (!scop->isProfitable(UnprofitableScalarAccs)) { if (!scop->isProfitable(UnprofitableScalarAccs)) {
scop->invalidate(PROFITABLE, DebugLoc()); scop->invalidate(PROFITABLE, DebugLoc());
DEBUG(dbgs() << "Bailing-out because SCoP is not considered profitable\n");
return; return;
} }
@ -1065,8 +1072,10 @@ void ScopBuilder::buildScop(Region &R, AssumptionCache &AC,
scop->addRecordedAssumptions(); scop->addRecordedAssumptions();
scop->simplifyContexts(); scop->simplifyContexts();
if (!scop->buildAliasChecks(AA)) if (!scop->buildAliasChecks(AA)) {
DEBUG(dbgs() << "Bailing-out because could not build alias checks\n");
return; return;
}
scop->hoistInvariantLoads(); scop->hoistInvariantLoads();
scop->canonicalizeDynamicBasePtrs(); scop->canonicalizeDynamicBasePtrs();
@ -1075,8 +1084,10 @@ void ScopBuilder::buildScop(Region &R, AssumptionCache &AC,
// Check late for a feasible runtime context because profitability did not // Check late for a feasible runtime context because profitability did not
// change. // change.
if (!scop->hasFeasibleRuntimeContext()) if (!scop->hasFeasibleRuntimeContext()) {
DEBUG(dbgs() << "Bailing-out because of unfeasible context (late)\n");
return; return;
}
#ifndef NDEBUG #ifndef NDEBUG
verifyUses(scop.get(), LI, DT); verifyUses(scop.get(), LI, DT);
@ -1103,6 +1114,7 @@ ScopBuilder::ScopBuilder(Region *R, AssumptionCache &AC, AliasAnalysis &AA,
if (!scop->hasFeasibleRuntimeContext()) { if (!scop->hasFeasibleRuntimeContext()) {
InfeasibleScops++; InfeasibleScops++;
Msg = "SCoP ends here but was dismissed."; Msg = "SCoP ends here but was dismissed.";
DEBUG(dbgs() << "SCoP detected but dismissed\n");
scop.reset(); scop.reset();
} else { } else {
Msg = "SCoP ends here."; Msg = "SCoP ends here.";

View File

@ -4574,6 +4574,7 @@ void Scop::addRecordedAssumptions() {
} }
void Scop::invalidate(AssumptionKind Kind, DebugLoc Loc, BasicBlock *BB) { void Scop::invalidate(AssumptionKind Kind, DebugLoc Loc, BasicBlock *BB) {
DEBUG(dbgs() << "Invalidate SCoP because of reason " << Kind << "\n");
addAssumption(Kind, isl_set_empty(getParamSpace().release()), Loc, addAssumption(Kind, isl_set_empty(getParamSpace().release()), Loc,
AS_ASSUMPTION, BB); AS_ASSUMPTION, BB);
} }