[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
This commit is contained in:
Johannes Doerfert 2015-09-26 13:41:43 +00:00
parent b396b3102f
commit c6987c18de
3 changed files with 36 additions and 4 deletions

View File

@ -1168,9 +1168,10 @@ private:
/// @brief Build Schedule and ScopStmts.
///
/// @param R The current region traversed.
/// @param LI The LoopInfo object.
/// @param SD The ScopDetection object.
/// @param R The current region traversed.
/// @param LI The LoopInfo object.
/// @param SD The ScopDetection object.
/// @param LoopSchedules Map from loops to their schedule and progress.
void buildSchedule(
Region *R, LoopInfo &LI, ScopDetection &SD,
DenseMap<Loop *, std::pair<isl_schedule *, unsigned>> &LoopSchedules);

View File

@ -2645,7 +2645,8 @@ void Scop::buildSchedule(
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;
}

View File

@ -0,0 +1,30 @@
; RUN: opt %loadPolly -polly-detect-unprofitable -polly-scops -analyze < %s
;
; Regression test that triggered a memory leak at some point (24947).
;
define void @snrm2() {
entry:
br label %for.body.56.lr.ph
for.body.56.lr.ph: ; preds = %entry
br label %for.body.56
for.body.56: ; preds = %for.inc.106, %for.body.56.lr.ph
br label %if.end.73
if.end.73: ; preds = %for.body.56
%cmp82 = fcmp ogt float undef, undef
br i1 %cmp82, label %if.then.84, label %if.end.100
if.then.84: ; preds = %if.end.73
br label %for.inc.106
if.end.100: ; preds = %if.end.73
br label %for.inc.106
for.inc.106: ; preds = %if.end.100, %if.then.84
br i1 undef, label %for.body.56, label %for.end.110
for.end.110: ; preds = %for.inc.106
ret void
}