Index: lib/Analysis/ScopInfo.cpp =================================================================== --- lib/Analysis/ScopInfo.cpp +++ lib/Analysis/ScopInfo.cpp @@ -1694,6 +1694,12 @@ if (!Schedule) Schedule = isl_schedule_empty(getParamSpace()); + // Build the statement for PHIs in the exit block (never nested in a + // scopped-loop) + isl_schedule *StmtSchedule = + buildBBScopStmt(getRegion().getExit(), TempScop, getRegion(), NestLoops); + Schedule = ScheduleCombineSequence(Schedule, StmtSchedule); + realignParams(); addParameterBounds(); simplifyAssumedContext();