[polly] r249426 - Introduce -polly-process-unprofitable

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 09:10:29 PDT 2015


Author: grosser
Date: Tue Oct  6 11:10:29 2015
New Revision: 249426

URL: http://llvm.org/viewvc/llvm-project?rev=249426&view=rev
Log:
Introduce -polly-process-unprofitable

This single option replaces -polly-detect-unprofitable and -polly-no-early-exit
and is supposed to be the only option that disables compile-time heuristics that
aim to bail out early on scops that are believed to not benefit from Polly
optimizations.

Suggested-by:  Johannes Doerfert

Modified:
    polly/trunk/include/polly/ScopDetection.h
    polly/trunk/lib/Analysis/ScopDetection.cpp
    polly/trunk/lib/CodeGen/IslAst.cpp
    polly/trunk/test/ScopDetect/invalid-latch-conditions.ll
    polly/trunk/test/ScopDetect/more-than-one-loop.ll
    polly/trunk/test/ScopDetect/non-affine-loop-condition-dependent-access.ll
    polly/trunk/test/ScopDetect/non-affine-loop.ll
    polly/trunk/test/ScopDetect/non-beneficial-loops-small-trip-count.ll
    polly/trunk/test/ScopDetect/non_affine_loop_condition.ll
    polly/trunk/test/ScopDetect/only-one-affine-loop.ll
    polly/trunk/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll
    polly/trunk/test/ScopDetectionDiagnostics/ReportUnprofitable.ll
    polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll
    polly/trunk/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll
    polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_condition.ll
    polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll
    polly/trunk/test/lit.site.cfg.in

Modified: polly/trunk/include/polly/ScopDetection.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetection.h?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetection.h (original)
+++ polly/trunk/include/polly/ScopDetection.h Tue Oct  6 11:10:29 2015
@@ -108,6 +108,7 @@ typedef std::map<const SCEVUnknown *, co
 extern bool PollyTrackFailures;
 extern bool PollyDelinearize;
 extern bool PollyUseRuntimeAliasChecks;
+extern bool PollyProcessUnprofitable;
 
 /// @brief A function attribute which will cause Polly to skip the function
 extern llvm::StringRef PollySkipFnAttr;

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Tue Oct  6 11:10:29 2015
@@ -73,10 +73,13 @@ using namespace polly;
 
 #define DEBUG_TYPE "polly-detect"
 
-static cl::opt<bool> DetectUnprofitable("polly-detect-unprofitable",
-                                        cl::desc("Detect unprofitable scops"),
-                                        cl::Hidden, cl::init(false),
-                                        cl::ZeroOrMore, cl::cat(PollyCategory));
+bool polly::PollyProcessUnprofitable;
+static cl::opt<bool, true> XPollyProcessUnprofitable(
+    "polly-process-unprofitable",
+    cl::desc(
+        "Process scops that are unlikely to benefit from Polly optimizations."),
+    cl::location(PollyProcessUnprofitable), cl::init(false), cl::ZeroOrMore,
+    cl::cat(PollyCategory));
 
 static cl::opt<std::string> OnlyFunction(
     "polly-only-func",
@@ -881,7 +884,7 @@ void ScopDetection::findScops(Region &R)
                            false /*verifying*/);
 
   bool RegionIsValid = false;
-  if (!DetectUnprofitable && regionWithoutLoops(R, LI)) {
+  if (!PollyProcessUnprofitable && regionWithoutLoops(R, LI)) {
     removeCachedResults(R);
     invalid<ReportUnprofitable>(Context, /*Assert=*/true, &R);
   } else
@@ -1000,7 +1003,7 @@ bool ScopDetection::isValidRegion(Detect
     return invalid<ReportEntry>(Context, /*Assert=*/true, CurRegion.getEntry());
 
   int NumLoops = countBeneficialLoops(&CurRegion);
-  if (!DetectUnprofitable && NumLoops < 2)
+  if (!PollyProcessUnprofitable && NumLoops < 2)
     invalid<ReportUnprofitable>(Context, /*Assert=*/true, &CurRegion);
 
   if (!allBlocksValid(Context))
@@ -1008,12 +1011,12 @@ bool ScopDetection::isValidRegion(Detect
 
   // We can probably not do a lot on scops that only write or only read
   // data.
-  if (!DetectUnprofitable && (!Context.hasStores || !Context.hasLoads))
+  if (!PollyProcessUnprofitable && (!Context.hasStores || !Context.hasLoads))
     invalid<ReportUnprofitable>(Context, /*Assert=*/true, &CurRegion);
 
   // Check if there are sufficent non-overapproximated loops.
   int NumAffineLoops = NumLoops - Context.BoxedLoopsSet.size();
-  if (!DetectUnprofitable && NumAffineLoops < 2)
+  if (!PollyProcessUnprofitable && NumAffineLoops < 2)
     invalid<ReportUnprofitable>(Context, /*Assert=*/true, &CurRegion);
 
   DEBUG(dbgs() << "OK\n");
@@ -1069,7 +1072,7 @@ void ScopDetection::emitMissedRemarksFor
 bool ScopDetection::runOnFunction(llvm::Function &F) {
   LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
   RI = &getAnalysis<RegionInfoPass>().getRegionInfo();
-  if (!DetectUnprofitable && LI->empty())
+  if (!PollyProcessUnprofitable && LI->empty())
     return false;
 
   AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();

Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Tue Oct  6 11:10:29 2015
@@ -71,11 +71,6 @@ static cl::opt<bool> DetectParallel("pol
                                     cl::init(false), cl::ZeroOrMore,
                                     cl::cat(PollyCategory));
 
-static cl::opt<bool> NoEarlyExit(
-    "polly-no-early-exit",
-    cl::desc("Do not exit early if no benefit of the Polly version was found."),
-    cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
-
 namespace polly {
 class IslAst {
 public:
@@ -370,8 +365,7 @@ void IslAst::buildRunCondition(__isl_kee
 ///       original as well as optimized SCoP (e.g., #stride-one-accesses).
 static bool benefitsFromPolly(Scop *Scop, bool PerformParallelTest) {
 
-  // First check the user choice.
-  if (NoEarlyExit)
+  if (PollyProcessUnprofitable)
     return true;
 
   // Check if nothing interesting happened.

Modified: polly/trunk/test/ScopDetect/invalid-latch-conditions.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/invalid-latch-conditions.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopDetect/invalid-latch-conditions.ll (original)
+++ polly/trunk/test/ScopDetect/invalid-latch-conditions.ll Tue Oct  6 11:10:29 2015
@@ -1,11 +1,11 @@
-; RUN: opt %loadPolly -polly-detect-unprofitable=false \
+; RUN: opt %loadPolly -polly-process-unprofitable=false \
 ; RUN:     -polly-detect -analyze < %s | FileCheck %s
 
 ; RUN: opt %loadPolly -polly-allow-nonaffine-loops \
 ; RUN:     -polly-detect -analyze < %s | FileCheck %s --check-prefix=NALOOPS
 
 ; RUN: opt %loadPolly -polly-allow-nonaffine-loops -polly-detect -analyze \
-; RUN:     -polly-detect-unprofitable=false < %s | \
+; RUN:     -polly-process-unprofitable=false < %s | \
 ; RUN:     FileCheck %s --check-prefix=PROFIT
 
 ; The latch conditions of the outer loop are not affine, thus the loop cannot

Modified: polly/trunk/test/ScopDetect/more-than-one-loop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/more-than-one-loop.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopDetect/more-than-one-loop.ll (original)
+++ polly/trunk/test/ScopDetect/more-than-one-loop.ll Tue Oct  6 11:10:29 2015
@@ -1,8 +1,8 @@
-; RUN: opt %loadPolly -polly-detect-unprofitable=false \
+; RUN: opt %loadPolly -polly-process-unprofitable=false \
 ; RUN: -polly-code-generator=isl \
 ; RUN: -polly-detect -analyze < %s | FileCheck %s
 
-; RUN: opt %loadPolly -polly-detect-unprofitable=true \
+; RUN: opt %loadPolly -polly-process-unprofitable=true \
 ; RUN: -polly-code-generator=isl \
 ; RUN: -polly-detect -analyze < %s | FileCheck %s
 

Modified: polly/trunk/test/ScopDetect/non-affine-loop-condition-dependent-access.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/non-affine-loop-condition-dependent-access.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopDetect/non-affine-loop-condition-dependent-access.ll (original)
+++ polly/trunk/test/ScopDetect/non-affine-loop-condition-dependent-access.ll Tue Oct  6 11:10:29 2015
@@ -1,7 +1,7 @@
 ; RUN: opt %loadPolly -basicaa -polly-detect -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=false -analyze < %s | FileCheck %s --check-prefix=REJECTNONAFFINELOOPS
 ; RUN: opt %loadPolly -basicaa -polly-detect -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -analyze < %s | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPS
 ; RUN: opt %loadPolly -basicaa -polly-detect -polly-allow-nonaffine -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -analyze < %s | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPSANDACCESSES
-; RUN: opt %loadPolly -basicaa -polly-detect -polly-detect-unprofitable=false \
+; RUN: opt %loadPolly -basicaa -polly-detect -polly-process-unprofitable=false \
 ; RUN:    -polly-allow-nonaffine -polly-allow-nonaffine-branches \
 ; RUN:    -polly-allow-nonaffine-loops=true -analyze < %s \
 ; RUN:    | FileCheck %s --check-prefix=PROFIT

Modified: polly/trunk/test/ScopDetect/non-affine-loop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/non-affine-loop.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopDetect/non-affine-loop.ll (original)
+++ polly/trunk/test/ScopDetect/non-affine-loop.ll Tue Oct  6 11:10:29 2015
@@ -12,7 +12,7 @@
 ; RUN:     -polly-allow-nonaffine-loops=true -polly-allow-nonaffine \
 ; RUN:     -analyze < %s | FileCheck %s \
 ; RUN:     --check-prefix=ALLOWNONAFFINELOOPSANDACCESSES
-; RUN: opt %loadPolly -polly-detect-unprofitable=false \
+; RUN: opt %loadPolly -polly-process-unprofitable=false \
 ; RUN:     -polly-detect -polly-allow-nonaffine-branches \
 ; RUN:     -polly-allow-nonaffine-loops=true -polly-allow-nonaffine \
 ; RUN:     -analyze < %s | FileCheck %s \

Modified: polly/trunk/test/ScopDetect/non-beneficial-loops-small-trip-count.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/non-beneficial-loops-small-trip-count.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopDetect/non-beneficial-loops-small-trip-count.ll (original)
+++ polly/trunk/test/ScopDetect/non-beneficial-loops-small-trip-count.ll Tue Oct  6 11:10:29 2015
@@ -1,4 +1,4 @@
-; RUN: opt %loadPolly -polly-detect-unprofitable=false -polly-detect \
+; RUN: opt %loadPolly -polly-process-unprofitable=false -polly-detect \
 ; RUN:   -analyze < %s | FileCheck %s
 ;
 ; CHECK-NOT: Valid

Modified: polly/trunk/test/ScopDetect/non_affine_loop_condition.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/non_affine_loop_condition.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopDetect/non_affine_loop_condition.ll (original)
+++ polly/trunk/test/ScopDetect/non_affine_loop_condition.ll Tue Oct  6 11:10:29 2015
@@ -1,7 +1,7 @@
 ; RUN: opt %loadPolly \
 ; RUN:   -polly-detect -polly-allow-nonaffine-loops -analyze \
 ; RUN:   < %s | FileCheck %s
-; RUN: opt %loadPolly -polly-detect-unprofitable=false \
+; RUN: opt %loadPolly -polly-process-unprofitable=false \
 ; RUN:   -polly-detect -polly-allow-nonaffine-loops -analyze \
 ; RUN:   < %s | FileCheck %s --check-prefix=PROFIT
 ;

Modified: polly/trunk/test/ScopDetect/only-one-affine-loop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetect/only-one-affine-loop.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopDetect/only-one-affine-loop.ll (original)
+++ polly/trunk/test/ScopDetect/only-one-affine-loop.ll Tue Oct  6 11:10:29 2015
@@ -1,4 +1,4 @@
-; RUN: opt %loadPolly -polly-detect -polly-detect-unprofitable=false -analyze \
+; RUN: opt %loadPolly -polly-detect -polly-process-unprofitable=false -analyze \
 ; RUN:     -polly-allow-nonaffine-loops < %s | FileCheck %s
 ;
 ; RUN: opt %loadPolly -polly-detect -analyze \

Modified: polly/trunk/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll (original)
+++ polly/trunk/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll Tue Oct  6 11:10:29 2015
@@ -7,7 +7,7 @@
 ; RUN:     -polly-allow-nonaffine-loops=true -polly-detect -analyze \
 ; RUN:     < %s 2>&1| FileCheck %s --check-prefix=ALLOWNONAFFINELOOPS
 ; RUN: opt %loadPolly -pass-remarks-missed="polly-detect" \
-; RUN:     -polly-detect-unprofitable=false \
+; RUN:     -polly-process-unprofitable=false \
 ; RUN:     -polly-detect-track-failures -polly-allow-nonaffine-loops=true \
 ; RUN:     -polly-allow-nonaffine -polly-detect -analyze < %s 2>&1 \
 ; RUN:     | FileCheck %s --check-prefix=ALLOWNONAFFINEALL

Modified: polly/trunk/test/ScopDetectionDiagnostics/ReportUnprofitable.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopDetectionDiagnostics/ReportUnprofitable.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopDetectionDiagnostics/ReportUnprofitable.ll (original)
+++ polly/trunk/test/ScopDetectionDiagnostics/ReportUnprofitable.ll Tue Oct  6 11:10:29 2015
@@ -1,6 +1,6 @@
 ; RUN: opt %loadPolly -pass-remarks-missed="polly-detect" \
 ; RUN:     -polly-detect-track-failures -polly-detect -analyze \
-; RUN:     -polly-detect-unprofitable=false < %s 2>&1| FileCheck %s
+; RUN:     -polly-process-unprofitable=false < %s 2>&1| FileCheck %s
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 
 ; void onlyWrite(float *A) {

Modified: polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll (original)
+++ polly/trunk/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll Tue Oct  6 11:10:29 2015
@@ -3,7 +3,7 @@
 ; RUN:     -polly-allow-nonaffine-loops=true -analyze < %s | FileCheck %s \
 ; RUN:     -check-prefix=SCALAR
 ; RUN: opt %loadPolly -basicaa -polly-scops -polly-allow-nonaffine \
-; RUN:     -polly-detect-unprofitable=false \
+; RUN:     -polly-process-unprofitable=false \
 ; RUN:     -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true \
 ; RUN:     -analyze < %s | FileCheck %s -check-prefix=PROFIT
 ;

Modified: polly/trunk/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll (original)
+++ polly/trunk/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll Tue Oct  6 11:10:29 2015
@@ -6,7 +6,7 @@
 ; RUN:     -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true \
 ; RUN:     -analyze < %s | FileCheck %s --check-prefix=ALL
 ; RUN: opt %loadPolly -polly-scops -polly-allow-nonaffine \
-; RUN:     -polly-detect-unprofitable=false \
+; RUN:     -polly-process-unprofitable=false \
 ; RUN:     -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true \
 ; RUN:     -analyze < %s | FileCheck %s --check-prefix=PROFIT
 ;

Modified: polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_condition.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_condition.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_condition.ll (original)
+++ polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_condition.ll Tue Oct  6 11:10:29 2015
@@ -2,7 +2,7 @@
 ; RUN:     -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops \
 ; RUN:     -analyze < %s | FileCheck %s
 ; RUN: opt %loadPolly -polly-scops -polly-allow-nonaffine-branches \
-; RUN:     -polly-detect-unprofitable=false \
+; RUN:     -polly-process-unprofitable=false \
 ; RUN:     -polly-allow-nonaffine-loops -analyze < %s | FileCheck %s \
 ; RUN:     --check-prefix=PROFIT
 

Modified: polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll (original)
+++ polly/trunk/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll Tue Oct  6 11:10:29 2015
@@ -2,7 +2,7 @@
 ; RUN:     -polly-allow-nonaffine -polly-allow-nonaffine-branches \
 ; RUN:     -polly-allow-nonaffine-loops -analyze < %s | FileCheck %s
 ; RUN: opt %loadPolly -polly-scops -polly-allow-nonaffine \
-; RUN:     -polly-detect-unprofitable=false \
+; RUN:     -polly-process-unprofitable=false \
 ; RUN:     -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops \
 ; RUN:     -analyze < %s | FileCheck %s --check-prefix=PROFIT
 ;

Modified: polly/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/lit.site.cfg.in?rev=249426&r1=249425&r2=249426&view=diff
==============================================================================
--- polly/trunk/test/lit.site.cfg.in (original)
+++ polly/trunk/test/lit.site.cfg.in Tue Oct  6 11:10:29 2015
@@ -36,13 +36,11 @@ if config.link_polly_into_tools == '' or
    config.link_polly_into_tools.lower() == 'link_polly_into_tools-notfound':
     config.substitutions.append(('%loadPolly', '-load '
                                  + config.polly_lib_dir + '/LLVMPolly at LLVM_SHLIBEXT@'
-                                 + ' -polly-detect-unprofitable '
-                                 + ' -polly-no-early-exit '
+                                 + ' -polly-process-unprofitable '
                                  ))
 else:
     config.substitutions.append(('%loadPolly', ''
-                                 + ' -polly-detect-unprofitable '
-                                 + ' -polly-no-early-exit '
+                                 + ' -polly-process-unprofitable '
                                  ))
 
 # Let the main config do the real work.




More information about the llvm-commits mailing list