Index: include/polly/ScopInfo.h =================================================================== --- include/polly/ScopInfo.h +++ include/polly/ScopInfo.h @@ -1287,6 +1287,9 @@ /// @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; @@ -2036,6 +2039,12 @@ /// >0 for other loops in the SCoP /// -1 if @p L is nullptr or there is no outermost loop in the SCoP int getRelativeLoopDepth(const Loop *L) const; + + /// @brief Indicate that the SCop encountered a complex CFG. + void markAsContainingComplexCFG() { HasComplexCFG = true; } + + /// @brief Check if the SCoP has a complex CFG. + bool hasComplexCFG() const { return HasComplexCFG; } }; /// @brief Print Scop scop to raw_ostream O. Index: lib/Analysis/ScopInfo.cpp =================================================================== --- lib/Analysis/ScopInfo.cpp +++ lib/Analysis/ScopInfo.cpp @@ -2284,6 +2284,11 @@ // 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 @@ -2294,6 +2299,7 @@ auto *Empty = isl_set_empty(isl_set_get_space(SuccDomain)); isl_set_free(SuccDomain); SuccDomain = Empty; + HasComplexCFG = true; invalidate(ERROR_DOMAINCONJUNCTS, DebugLoc()); } } @@ -2771,9 +2777,10 @@ 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(); }