[NFC] Check for feasibility prior to the profitability check
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>
Thu, 1 Dec 2016 11:12:14 +0000 (11:12 +0000)
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>
Thu, 1 Dec 2016 11:12:14 +0000 (11:12 +0000)
Feasibility is checked late on its own but early it is hidden behind
the "PollyProcessUnprofitable" guard. This change will make sure we opt
out early if the runtime context is infeasible anyway.

llvm-svn: 288329

polly/lib/Analysis/ScopInfo.cpp

index 9b15a1d..a8d64d8 100644 (file)
@@ -3109,6 +3109,10 @@ void Scop::init(AliasAnalysis &AA, AssumptionCache &AC, DominatorTree &DT,
   for (ScopStmt &Stmt : Stmts)
     Stmt.init(LI);
 
+  // Check early for a feasible runtime context.
+  if (!hasFeasibleRuntimeContext())
+    return;
+
   // Check early for profitability. Afterwards it cannot change anymore,
   // only the runtime context could become infeasible.
   if (!isProfitable()) {
@@ -3137,10 +3141,8 @@ void Scop::init(AliasAnalysis &AA, AssumptionCache &AC, DominatorTree &DT,
 
   // Check late for a feasible runtime context because profitability did not
   // change.
-  if (!hasFeasibleRuntimeContext()) {
-    invalidate(PROFITABLE, DebugLoc());
+  if (!hasFeasibleRuntimeContext())
     return;
-  }
 }
 
 Scop::~Scop() {
@@ -3612,9 +3614,6 @@ bool Scop::isProfitable() const {
   if (PollyProcessUnprofitable)
     return true;
 
-  if (!hasFeasibleRuntimeContext())
-    return false;
-
   if (isEmpty())
     return false;