[ScopInfo] Allow uniform branch conditions
If all but one branch come from an error condition and the incoming value from
this branch is a constant, we can model this branch.
llvm-svn: 314116
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index fb951c5..df3acd1 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -588,6 +588,13 @@
}
}
+ if (auto PHI = dyn_cast<PHINode>(Condition)) {
+ auto *Unique = dyn_cast_or_null<ConstantInt>(
+ getUniqueNonErrorValue(PHI, &Context.CurRegion, LI, DT));
+ if (Unique && (Unique->isZero() || Unique->isOne()))
+ return true;
+ }
+
// Non constant conditions of branches need to be ICmpInst.
if (!isa<ICmpInst>(Condition)) {
if (!IsLoopBranch && AllowNonAffineSubRegions &&