[polly] r273906 - Add comment on why loops/regions can overlap. NFC.
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 27 12:00:55 PDT 2016
Author: meinersbur
Date: Mon Jun 27 14:00:55 2016
New Revision: 273906
URL: http://llvm.org/viewvc/llvm-project?rev=273906&view=rev
Log:
Add comment on why loops/regions can overlap. NFC.
The case is described in llvm.org/PR28071 which was fixed in the
previous commit.
Modified:
polly/trunk/lib/Analysis/ScopDetection.cpp
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=273906&r1=273905&r2=273906&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Mon Jun 27 14:00:55 2016
@@ -309,6 +309,35 @@ bool ScopDetection::addOverApproximatedR
// Reject if the surrounding loop does not entirely contain the nonaffine
// subregion.
+ // This can happen because a region can contain BBs that have no path to the
+ // exit block (Infinite loops, UnreachableInst), but such blocks are never
+ // part of a loop.
+ //
+ // _______________
+ // | Loop Header | <-----------.
+ // --------------- |
+ // | |
+ // _______________ ______________
+ // | RegionEntry |-----> | RegionExit |----->
+ // --------------- --------------
+ // |
+ // _______________
+ // | EndlessLoop | <--.
+ // --------------- |
+ // | |
+ // \------------/
+ //
+ // In the example above, the loop (LoopHeader,RegionEntry,RegionExit) is
+ // neither entirely contained in the region RegionEntry->RegionExit
+ // (containing RegionEntry,EndlessLoop) nor is the region entirely contained
+ // in the loop.
+ // The block EndlessLoop is contained is in the region because
+ // Region::contains tests whether it is not dominated by RegionExit. This is
+ // probably to not having to query the PostdominatorTree.
+ // Instead of an endless loop, a dead end can also be formed by
+ // UnreachableInst. This case is already caught by isErrorBlock(). We hence
+ // only have to test whether there is an endless loop not contained in the
+ // surrounding loop.
BasicBlock *BBEntry = AR->getEntry();
Loop *L = LI->getLoopFor(BBEntry);
while (L && AR->contains(L))
More information about the llvm-commits
mailing list