Skip to content

Commit

Permalink
Invalidate scop on encountering a complex control flow
Browse files Browse the repository at this point in the history
We bail out if current scop has a complex control flow as this could lead to
building of large domain conditions. This is to reduce compile time.  This
addresses r26382.

Contributed-by: Chris Jenneisch <chrisj@codeaurora.org>

Differential Revision: http://reviews.llvm.org/D18362

llvm-svn: 264105
  • Loading branch information
tobiasgrosser committed Mar 22, 2016
1 parent c839197 commit 5a8c052
Show file tree
Hide file tree
Showing 3 changed files with 547 additions and 3 deletions.
3 changes: 3 additions & 0 deletions polly/include/polly/ScopInfo.h
Expand Up @@ -1287,6 +1287,9 @@ class Scop {
/// @brief Flag to remember if the SCoP contained an error block or not.
bool HasErrorBlock;

/// @brief Flag to indicate if the SCop has a complex control flow.
bool HasComplexCFG;

/// Max loop depth.
unsigned MaxLoopDepth;

Expand Down
13 changes: 10 additions & 3 deletions polly/lib/Analysis/ScopInfo.cpp
Expand Up @@ -2284,6 +2284,11 @@ void Scop::buildDomainsWithBranchConstraints(Region *R, ScopDetection &SD,
// case there are multiple paths (without loop back edges) to the
// successor block.
isl_set *&SuccDomain = DomainMap[SuccBB];

if (HasComplexCFG) {
isl_set_free(CondSet);
continue;
}
if (!SuccDomain)
SuccDomain = CondSet;
else
Expand All @@ -2294,6 +2299,7 @@ void Scop::buildDomainsWithBranchConstraints(Region *R, ScopDetection &SD,
auto *Empty = isl_set_empty(isl_set_get_space(SuccDomain));
isl_set_free(SuccDomain);
SuccDomain = Empty;
HasComplexCFG = true;
invalidate(ERROR_DOMAINCONJUNCTS, DebugLoc());
}
}
Expand Down Expand Up @@ -2771,9 +2777,10 @@ Scop::Scop(Region &R, ScalarEvolution &ScalarEvolution, LoopInfo &LI,
unsigned MaxLoopDepth)
: SE(&ScalarEvolution), R(R), IsOptimized(false),
HasSingleExitEdge(R.getExitingBlock()), HasErrorBlock(false),
MaxLoopDepth(MaxLoopDepth), IslCtx(isl_ctx_alloc(), isl_ctx_free),
Context(nullptr), Affinator(this, LI), AssumedContext(nullptr),
InvalidContext(nullptr), Schedule(nullptr) {
HasComplexCFG(false), MaxLoopDepth(MaxLoopDepth),
IslCtx(isl_ctx_alloc(), isl_ctx_free), Context(nullptr),
Affinator(this, LI), AssumedContext(nullptr), InvalidContext(nullptr),
Schedule(nullptr) {
isl_options_set_on_error(getIslCtx(), ISL_ON_ERROR_ABORT);
buildContext();
}
Expand Down

0 comments on commit 5a8c052

Please sign in to comment.