Support SCoPs with multiple exit edges
Regions that have multiple exit edges are very common. A simple if condition
yields e.g. such a region:
if
/ \
then else
\ /
after
Region: if -> after
This regions contains the bbs 'if', 'then', 'else', but not 'after'. It has
two exit edges 'then' -> 'after' and 'else' -> 'after'.
Previously we scheduled the RegionSimplify pass to translate such regions into
simple regions. With this patch, we now support them natively.
Contributed-by: Star Tan <tanmx_star@yeah.net>
llvm-svn: 179159
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index d67f2d1..f0bbf3d7 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -554,9 +554,9 @@
if (R.getEntry() == &(R.getEntry()->getParent()->getEntryBlock()))
INVALID(Other, "Region containing entry block of function is invalid!");
- // Only a simple region is allowed.
- if (!R.isSimple())
- INVALID(SimpleRegion, "Region not simple: " << R.getNameStr());
+ // Only regions that have a single entry are allowed.
+ if (!R.getEnteringBlock())
+ INVALID(SimpleRegion, "Region has multiple entries: " << R.getNameStr());
if (!isValidExit(Context))
return false;