[FIX] Use the surrounding loop for non-affine SCoP regions
When the whole SCoP is a non-affine region we need to use the
surrounding loop in the construction of the schedule as that is
the one that will be looked up after the schedule generation.
This fixes bug 24947
llvm-svn: 248667
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index b8c3b151..564147b 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -2645,7 +2645,8 @@
auto *Stmt = addScopStmt(nullptr, R);
auto *UDomain = isl_union_set_from_set(Stmt->getDomain());
auto *StmtSchedule = isl_schedule_from_domain(UDomain);
- auto &LSchedulePair = LoopSchedules[nullptr];
+ Loop *L = getLoopSurroundingRegion(*R, LI);
+ auto &LSchedulePair = LoopSchedules[L];
LSchedulePair.first = StmtSchedule;
return;
}