diff options
| author | Tobias Grosser <tobias@grosser.es> | 2015-10-06 16:10:29 +0000 |
|---|---|---|
| committer | Tobias Grosser <tobias@grosser.es> | 2015-10-06 16:10:29 +0000 |
| commit | 575aca8d43be78a49a868c6b4f9db24e03737cb8 (patch) | |
| tree | 5697b1d0dda55bb1f891bb4aa80233dc6aa9d0a0 | |
| parent | 873111ec10d330460b5f1d8d55d34f649bc2e3d2 (diff) | |
| download | bcm5719-llvm-575aca8d43be78a49a868c6b4f9db24e03737cb8.tar.gz bcm5719-llvm-575aca8d43be78a49a868c6b4f9db24e03737cb8.zip | |
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
llvm-svn: 249426
17 files changed, 31 insertions, 35 deletions
diff --git a/polly/include/polly/ScopDetection.h b/polly/include/polly/ScopDetection.h index 198dba80b3a..67c7bf75ed5 100644 --- a/polly/include/polly/ScopDetection.h +++ b/polly/include/polly/ScopDetection.h @@ -108,6 +108,7 @@ typedef std::map<const SCEVUnknown *, const SCEV *> BaseToElSize; 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; diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index adf2023bc87..ec54e4fbf47 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -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(DetectionContext &Context) const { 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(DetectionContext &Context) const { // 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::emitMissedRemarksForLeaves(const Function &F, 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(); diff --git a/polly/lib/CodeGen/IslAst.cpp b/polly/lib/CodeGen/IslAst.cpp index 40a0c6d58c8..1d9d30b3a32 100644 --- a/polly/lib/CodeGen/IslAst.cpp +++ b/polly/lib/CodeGen/IslAst.cpp @@ -71,11 +71,6 @@ static cl::opt<bool> DetectParallel("polly-ast-detect-parallel", 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_keep isl_ast_build *Build) { /// 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. diff --git a/polly/test/ScopDetect/invalid-latch-conditions.ll b/polly/test/ScopDetect/invalid-latch-conditions.ll index a4496e02e8a..debec14ff36 100644 --- a/polly/test/ScopDetect/invalid-latch-conditions.ll +++ b/polly/test/ScopDetect/invalid-latch-conditions.ll @@ -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 diff --git a/polly/test/ScopDetect/more-than-one-loop.ll b/polly/test/ScopDetect/more-than-one-loop.ll index eae43cc843c..8393306ce8e 100644 --- a/polly/test/ScopDetect/more-than-one-loop.ll +++ b/polly/test/ScopDetect/more-than-one-loop.ll @@ -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 diff --git a/polly/test/ScopDetect/non-affine-loop-condition-dependent-access.ll b/polly/test/ScopDetect/non-affine-loop-condition-dependent-access.ll index 6fb9fd9e400..721ce869c70 100644 --- a/polly/test/ScopDetect/non-affine-loop-condition-dependent-access.ll +++ b/polly/test/ScopDetect/non-affine-loop-condition-dependent-access.ll @@ -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 diff --git a/polly/test/ScopDetect/non-affine-loop.ll b/polly/test/ScopDetect/non-affine-loop.ll index af33532b6f3..5ec0187841d 100644 --- a/polly/test/ScopDetect/non-affine-loop.ll +++ b/polly/test/ScopDetect/non-affine-loop.ll @@ -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 \ diff --git a/polly/test/ScopDetect/non-beneficial-loops-small-trip-count.ll b/polly/test/ScopDetect/non-beneficial-loops-small-trip-count.ll index 89c53f85166..3911b66ad32 100644 --- a/polly/test/ScopDetect/non-beneficial-loops-small-trip-count.ll +++ b/polly/test/ScopDetect/non-beneficial-loops-small-trip-count.ll @@ -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 diff --git a/polly/test/ScopDetect/non_affine_loop_condition.ll b/polly/test/ScopDetect/non_affine_loop_condition.ll index d3b0129b6d2..2f40a471ae8 100644 --- a/polly/test/ScopDetect/non_affine_loop_condition.ll +++ b/polly/test/ScopDetect/non_affine_loop_condition.ll @@ -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 ; diff --git a/polly/test/ScopDetect/only-one-affine-loop.ll b/polly/test/ScopDetect/only-one-affine-loop.ll index 0fe09d0d9ba..a57255ec002 100644 --- a/polly/test/ScopDetect/only-one-affine-loop.ll +++ b/polly/test/ScopDetect/only-one-affine-loop.ll @@ -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 \ diff --git a/polly/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll b/polly/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll index 1edd60c740d..ca43c8f3de3 100644 --- a/polly/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll +++ b/polly/test/ScopDetectionDiagnostics/ReportLoopBound-01.ll @@ -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 diff --git a/polly/test/ScopDetectionDiagnostics/ReportUnprofitable.ll b/polly/test/ScopDetectionDiagnostics/ReportUnprofitable.ll index 58a2fc3310a..c41d4e86529 100644 --- a/polly/test/ScopDetectionDiagnostics/ReportUnprofitable.ll +++ b/polly/test/ScopDetectionDiagnostics/ReportUnprofitable.ll @@ -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) { diff --git a/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll b/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll index 278f964c7ad..77dd4276cbe 100644 --- a/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll +++ b/polly/test/ScopInfo/NonAffine/non-affine-loop-condition-dependent-access_1.ll @@ -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 ; diff --git a/polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll b/polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll index 1db5b3e1c15..51839c2766f 100644 --- a/polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll +++ b/polly/test/ScopInfo/NonAffine/non_affine_conditional_surrounding_non_affine_loop.ll @@ -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 ; diff --git a/polly/test/ScopInfo/NonAffine/non_affine_loop_condition.ll b/polly/test/ScopInfo/NonAffine/non_affine_loop_condition.ll index d35b78f96e1..ed1e65e2e73 100644 --- a/polly/test/ScopInfo/NonAffine/non_affine_loop_condition.ll +++ b/polly/test/ScopInfo/NonAffine/non_affine_loop_condition.ll @@ -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 diff --git a/polly/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll b/polly/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll index ed7c0ecee21..231d014a473 100644 --- a/polly/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll +++ b/polly/test/ScopInfo/NonAffine/non_affine_loop_used_later.ll @@ -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 ; diff --git a/polly/test/lit.site.cfg.in b/polly/test/lit.site.cfg.in index 8c9a3a132f4..be469a5461d 100644 --- a/polly/test/lit.site.cfg.in +++ b/polly/test/lit.site.cfg.in @@ -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@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. |

