[ScopInfo] Allow invariant loads in branch conditions
In case the value used in a branch condition is a load instruction, assume this
load to be invariant.
llvm-svn: 314146
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index df3acd1..38b7be1 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -595,6 +595,12 @@
return true;
}
+ if (auto Load = dyn_cast<LoadInst>(Condition))
+ if (!IsLoopBranch) {
+ Context.RequiredILS.insert(Load);
+ return true;
+ }
+
// Non constant conditions of branches need to be ICmpInst.
if (!isa<ICmpInst>(Condition)) {
if (!IsLoopBranch && AllowNonAffineSubRegions &&