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

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 04:52:03 PDT 2017


Author: meinersbur
Date: Wed Aug 30 04:52:03 2017
New Revision: 312113

URL: http://llvm.org/viewvc/llvm-project?rev=312113&view=rev
Log:
[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.

Modified:
    polly/trunk/lib/Analysis/ScopBuilder.cpp
    polly/trunk/lib/Analysis/ScopInfo.cpp

Modified: polly/trunk/lib/Analysis/ScopBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopBuilder.cpp?rev=312113&r1=312112&r2=312113&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopBuilder.cpp (original)
+++ polly/trunk/lib/Analysis/ScopBuilder.cpp Wed Aug 30 04:52:03 2017
@@ -1017,8 +1017,10 @@ void ScopBuilder::buildScop(Region &R, A
   /// A map from basic blocks to their invalid domains.
   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;
+  }
 
   scop->addUserAssumptions(AC, DT, LI, InvalidDomainMap);
 
@@ -1034,21 +1036,26 @@ void ScopBuilder::buildScop(Region &R, A
   // Exit early in case there are no executable statements left in this scop.
   scop->removeStmtNotInDomainMap();
   scop->simplifySCoP(false);
-  if (scop->isEmpty())
+  if (scop->isEmpty()) {
+    DEBUG(dbgs() << "Bailing-out because SCoP is empty\n");
     return;
+  }
 
   // The ScopStmts now have enough information to initialize themselves.
   for (ScopStmt &Stmt : *scop)
     Stmt.init(LI);
 
   // Check early for a feasible runtime context.
-  if (!scop->hasFeasibleRuntimeContext())
+  if (!scop->hasFeasibleRuntimeContext()) {
+    DEBUG(dbgs() << "Bailing-out because of unfeasible context (early)\n");
     return;
+  }
 
   // Check early for profitability. Afterwards it cannot change anymore,
   // only the runtime context could become infeasible.
   if (!scop->isProfitable(UnprofitableScalarAccs)) {
     scop->invalidate(PROFITABLE, DebugLoc());
+    DEBUG(dbgs() << "Bailing-out because SCoP is not considered profitable\n");
     return;
   }
 
@@ -1065,8 +1072,10 @@ void ScopBuilder::buildScop(Region &R, A
   scop->addRecordedAssumptions();
 
   scop->simplifyContexts();
-  if (!scop->buildAliasChecks(AA))
+  if (!scop->buildAliasChecks(AA)) {
+    DEBUG(dbgs() << "Bailing-out because could not build alias checks\n");
     return;
+  }
 
   scop->hoistInvariantLoads();
   scop->canonicalizeDynamicBasePtrs();
@@ -1075,8 +1084,10 @@ void ScopBuilder::buildScop(Region &R, A
 
   // Check late for a feasible runtime context because profitability did not
   // change.
-  if (!scop->hasFeasibleRuntimeContext())
+  if (!scop->hasFeasibleRuntimeContext()) {
+    DEBUG(dbgs() << "Bailing-out because of unfeasible context (late)\n");
     return;
+  }
 
 #ifndef NDEBUG
   verifyUses(scop.get(), LI, DT);
@@ -1103,6 +1114,7 @@ ScopBuilder::ScopBuilder(Region *R, Assu
   if (!scop->hasFeasibleRuntimeContext()) {
     InfeasibleScops++;
     Msg = "SCoP ends here but was dismissed.";
+    DEBUG(dbgs() << "SCoP detected but dismissed\n");
     scop.reset();
   } else {
     Msg = "SCoP ends here.";

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=312113&r1=312112&r2=312113&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Wed Aug 30 04:52:03 2017
@@ -4574,6 +4574,7 @@ void Scop::addRecordedAssumptions() {
 }
 
 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,
                 AS_ASSUMPTION, BB);
 }




More information about the llvm-commits mailing list