[FIX] Do not create a SCoP in the presence of infinite loops
If a loop has no exiting blocks the region covering we use during
schedule genertion might not cover that loop properly. For now we bail
out as we would not optimize these loops anyway.
llvm-svn: 265280
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 594d656..c0dba12 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -1029,8 +1029,14 @@
// Ensure the loop has valid exiting blocks as well as latches, otherwise we
// need to overapproximate it as a boxed loop.
SmallVector<BasicBlock *, 4> LoopControlBlocks;
- L->getLoopLatches(LoopControlBlocks);
L->getExitingBlocks(LoopControlBlocks);
+
+ // Loops without exiting blocks cannot be handled by the schedule generation
+ // as it depends on a region covering that is not given.
+ if (LoopControlBlocks.empty())
+ return false;
+
+ L->getLoopLatches(LoopControlBlocks);
for (BasicBlock *ControlBB : LoopControlBlocks) {
if (!isValidCFG(*ControlBB, true, false, Context))
return false;