diff options
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
| -rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index bd68ef5c817..4c5c95af6e6 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -1297,6 +1297,18 @@ bool ScopDetection::isValidLoop(Loop *L, DetectionContext &Context) const { if (!hasExitingBlocks(L)) return invalid<ReportLoopHasNoExit>(Context, /*Assert=*/true, L); + // The algorithm for domain construction assumes that loops has only a single + // exit block (and hence corresponds to a subregion). Note that we cannot use + // L->getExitBlock() because it does not check whether all exiting edges point + // to the same BB. + SmallVector<BasicBlock *, 4> ExitBlocks; + L->getExitBlocks(ExitBlocks); + BasicBlock *TheExitBlock = ExitBlocks[0]; + for (BasicBlock *ExitBB : ExitBlocks) { + if (TheExitBlock != ExitBB) + return invalid<ReportLoopHasMultipleExits>(Context, /*Assert=*/true, L); + } + if (canUseISLTripCount(L, Context)) return true; |

