[polly] r269343 - Check late for profitability

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 13:21:51 PDT 2016


Author: jdoerfert
Date: Thu May 12 15:21:50 2016
New Revision: 269343

URL: http://llvm.org/viewvc/llvm-project?rev=269343&view=rev
Log:
Check late for profitability

  Before this patch we only expanded valid __and__ profitable region. Therefor
  we did not allow the expansion to create a profitable region from a
  non-profitable one.  With this patch we will remember and expand all valid
  regions and check for profitability only at the end.

  This patch increases the number of valid SCoPs in the LLVM-TS and SPEC
  2000/2006 by 28% (from 303 to 390), including the hot loop in hmmer.


Modified:
    polly/trunk/lib/Analysis/ScopDetection.cpp

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=269343&r1=269342&r2=269343&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Thu May 12 15:21:50 2016
@@ -1350,9 +1350,6 @@ bool ScopDetection::isValidRegion(Detect
     return invalid<ReportIrreducibleRegion>(Context, /*Assert=*/true,
                                             &CurRegion, DbgLoc);
 
-  if (!isProfitableRegion(Context))
-    return false;
-
   DEBUG(dbgs() << "OK\n");
   return true;
 }
@@ -1472,6 +1469,19 @@ bool ScopDetection::runOnFunction(llvm::
 
   findScops(*TopRegion);
 
+  // Prune non-profitable regions.
+  for (auto &DIt : DetectionContextMap) {
+    auto &DC = DIt.getSecond();
+    if (DC.Log.hasErrors())
+      continue;
+    if (!ValidRegions.count(&DC.CurRegion))
+      continue;
+    if (isProfitableRegion(DC))
+      continue;
+
+    ValidRegions.remove(&DC.CurRegion);
+  }
+
   // Only makes sense when we tracked errors.
   if (PollyTrackFailures)
     emitMissedRemarks(F);




More information about the llvm-commits mailing list