diff options
author | Michael Kruse <llvm@meinersbur.de> | 2018-05-09 16:23:56 +0000 |
---|---|---|
committer | Michael Kruse <llvm@meinersbur.de> | 2018-05-09 16:23:56 +0000 |
commit | e330071b4354f8cdd8908a143d0f225a7ad0fd67 (patch) | |
tree | 3aa9596b03d356faffda128f253e9a8f652e5ccf /polly/lib/Analysis/ScopInfo.cpp | |
parent | cb7912cc0ff8e9adbfd1ffe4aa13310512ee737d (diff) | |
download | bcm5719-llvm-e330071b4354f8cdd8908a143d0f225a7ad0fd67.tar.gz bcm5719-llvm-e330071b4354f8cdd8908a143d0f225a7ad0fd67.zip |
[ScopInfo] Remove bail out condition in buildMinMaxAccess().
The condition was introduced in r267142 to mitigate a long compile-time
case. In r306087, a max-computation limit was introduced that should
handle the same case while leaving the max disjuncts heuristic it
should have replaced intact.
Today, the max disjuncts bail-out causes problems in that it prematurely
stops SCoPs from being detected, e.g. in SPEC's lbm. This would hit less
like if isl_set_coalesce would be called after isl_set_remove_divs
(which makes more basic_set likely to be coalescable) instead of before.
This patch tries to remove the premature max-disjuncts bail-out
condition by using simple_hull() to reduce the computational overhead,
instead of directly invalidating that SCoP.
Differential Revision: https://reviews.llvm.org/D45066
Contributed-by: Sahil Girish Yerawar <cs15btech11044@iith.ac.in>
llvm-svn: 331891
Diffstat (limited to 'polly/lib/Analysis/ScopInfo.cpp')
-rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index e7c924013fc..b12aa1e482f 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -24,6 +24,7 @@ #include "polly/ScopDetection.h" #include "polly/Support/GICHelper.h" #include "polly/Support/ISLOStream.h" +#include "polly/Support/ISLTools.h" #include "polly/Support/SCEVAffinator.h" #include "polly/Support/SCEVValidator.h" #include "polly/Support/ScopHelper.h" @@ -2307,12 +2308,12 @@ buildMinMaxAccess(isl::set Set, Scop::MinMaxVectorTy &MinMaxAccesses, Scop &S) { isl::pw_aff LastDimAff; isl::aff OneAff; unsigned Pos; - isl::ctx Ctx = Set.get_ctx(); Set = Set.remove_divs(); + polly::simplify(Set); - if (isl_set_n_basic_set(Set.get()) >= MaxDisjunctsInDomain) - return isl::stat::error; + if (isl_set_n_basic_set(Set.get()) > RunTimeChecksMaxAccessDisjuncts) + Set = Set.simple_hull(); // Restrict the number of parameters involved in the access as the lexmin/ // lexmax computation will take too long if this number is high. @@ -2338,15 +2339,9 @@ buildMinMaxAccess(isl::set Set, Scop::MinMaxVectorTy &MinMaxAccesses, Scop &S) { return isl::stat::error; } - if (isl_set_n_basic_set(Set.get()) > RunTimeChecksMaxAccessDisjuncts) - return isl::stat::error; - MinPMA = Set.lexmin_pw_multi_aff(); MaxPMA = Set.lexmax_pw_multi_aff(); - if (isl_ctx_last_error(Ctx.get()) == isl_error_quota) - return isl::stat::error; - MinPMA = MinPMA.coalesce(); MaxPMA = MaxPMA.coalesce(); @@ -2354,7 +2349,9 @@ buildMinMaxAccess(isl::set Set, Scop::MinMaxVectorTy &MinMaxAccesses, Scop &S) { // enclose the accessed memory region by MinPMA and MaxPMA. The pointer // we test during code generation might now point after the end of the // allocated array but we will never dereference it anyway. - assert(MaxPMA.dim(isl::dim::out) && "Assumed at least one output dimension"); + assert((!MaxPMA || MaxPMA.dim(isl::dim::out)) && + "Assumed at least one output dimension"); + Pos = MaxPMA.dim(isl::dim::out) - 1; LastDimAff = MaxPMA.get_pw_aff(Pos); OneAff = isl::aff(isl::local_space(LastDimAff.get_domain_space())); @@ -2362,6 +2359,9 @@ buildMinMaxAccess(isl::set Set, Scop::MinMaxVectorTy &MinMaxAccesses, Scop &S) { LastDimAff = LastDimAff.add(OneAff); MaxPMA = MaxPMA.set_pw_aff(Pos, LastDimAff); + if (!MinPMA || !MaxPMA) + return isl::stat::error; + MinMaxAccesses.push_back(std::make_pair(MinPMA, MaxPMA)); return isl::stat::ok; @@ -2386,8 +2386,6 @@ static bool calculateMinMaxAccess(Scop::AliasGroupTy AliasGroup, Scop &S, Accesses = Accesses.intersect_domain(Domains); isl::union_set Locations = Accesses.range(); - Locations = Locations.coalesce(); - Locations = Locations.detect_equalities(); auto Lambda = [&MinMaxAccesses, &S](isl::set Set) -> isl::stat { return buildMinMaxAccess(Set, MinMaxAccesses, S); |