diff options
| author | Michael Kruse <llvm@meinersbur.de> | 2016-06-27 19:00:49 +0000 |
|---|---|---|
| committer | Michael Kruse <llvm@meinersbur.de> | 2016-06-27 19:00:49 +0000 |
| commit | 41f046a282915f3009fd8667121467157eefd346 (patch) | |
| tree | 7318498b78bf3e5b03d9b8befa2498fab6bcbaea /polly/lib/Analysis/ScopDetection.cpp | |
| parent | bedd1f9d3d45bc4e62a8b8806598fc5ae327bf92 (diff) | |
| download | bcm5719-llvm-41f046a282915f3009fd8667121467157eefd346.tar.gz bcm5719-llvm-41f046a282915f3009fd8667121467157eefd346.zip | |
Fix assertion due to loop overlap with nonaffine region.
Reject and report regions that contains loops overlapping nonaffine region.
This situation typically happens in the presence of inifinite loops.
This addresses bug llvm.org/PR28071.
Differential Revision: http://reviews.llvm.org/D21312
Contributed-by: Huihui Zhang <huihuiz@codeaurora.org>
llvm-svn: 273905
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
| -rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 7036fe525f3..d6721302b34 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -296,10 +296,28 @@ bool ScopDetection::addOverApproximatedRegion(Region *AR, // All loops in the region have to be overapproximated too if there // are accesses that depend on the iteration count. + + BoxedLoopsSetTy ARBoxedLoopsSet; + for (BasicBlock *BB : AR->blocks()) { Loop *L = LI->getLoopFor(BB); - if (AR->contains(L)) + if (AR->contains(L)) { Context.BoxedLoopsSet.insert(L); + ARBoxedLoopsSet.insert(L); + } + } + + // Reject if the surrounding loop does not entirely contain the nonaffine + // subregion. + BasicBlock *BBEntry = AR->getEntry(); + Loop *L = LI->getLoopFor(BBEntry); + while (L && AR->contains(L)) + L = L->getParentLoop(); + if (L) { + for (const auto *ARBoxedLoop : ARBoxedLoopsSet) + if (!L->contains(ARBoxedLoop)) + return invalid<ReportLoopOverlapWithNonAffineSubRegion>( + Context, /*Assert=*/true, L, AR); } return (AllowNonAffineSubLoops || Context.BoxedLoopsSet.empty()); |

