forked from OSchip/llvm-project
[Polly] Fix -polly-opt-isl -analyze
The member LastSchedule was never set, such that printScop would always print "n/a" instead of the last schedule. To ensure that the isl_ctx lives as least as long as the stored schedule, also store a shared_ptr. Also set the schedule tree output style to ISL_YAML_STYLE_BLOCK to avoid printing everything on a single line. `opt -polly-opt-isl -analyze` will be used in the next commit.
This commit is contained in:
parent
1d68a780b3
commit
32bf468420
|
@ -1389,7 +1389,7 @@ public:
|
|||
|
||||
explicit IslScheduleOptimizer() : ScopPass(ID) {}
|
||||
|
||||
~IslScheduleOptimizer() override { isl_schedule_free(LastSchedule); }
|
||||
~IslScheduleOptimizer() override { releaseMemory(); }
|
||||
|
||||
/// Optimize the schedule of the SCoP @p S.
|
||||
bool runOnScop(Scop &S) override;
|
||||
|
@ -1404,9 +1404,11 @@ public:
|
|||
void releaseMemory() override {
|
||||
isl_schedule_free(LastSchedule);
|
||||
LastSchedule = nullptr;
|
||||
IslCtx.reset();
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<isl_ctx> IslCtx;
|
||||
isl_schedule *LastSchedule = nullptr;
|
||||
};
|
||||
} // namespace
|
||||
|
@ -1630,6 +1632,8 @@ bool IslScheduleOptimizer::runOnScop(Scop &S) {
|
|||
ScopsOptimized++;
|
||||
NumAffineLoopsOptimized += ScopStats.NumAffineLoops;
|
||||
NumBoxedLoopsOptimized += ScopStats.NumBoxedLoops;
|
||||
LastSchedule = NewSchedule.copy();
|
||||
IslCtx = S.getSharedIslCtx();
|
||||
|
||||
S.setScheduleTree(NewSchedule);
|
||||
S.markAsOptimized();
|
||||
|
@ -1652,6 +1656,7 @@ void IslScheduleOptimizer::printScop(raw_ostream &OS, Scop &) const {
|
|||
}
|
||||
|
||||
p = isl_printer_to_str(isl_schedule_get_ctx(LastSchedule));
|
||||
p = isl_printer_set_yaml_style(p, ISL_YAML_STYLE_BLOCK);
|
||||
p = isl_printer_print_schedule(p, LastSchedule);
|
||||
ScheduleStr = isl_printer_get_str(p);
|
||||
isl_printer_free(p);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
; C[i][j] += alpha * A[i][k] * B[k][j];
|
||||
; }
|
||||
;
|
||||
; CHECK-LABEL: Printing analysis 'Polly - Generate an AST from the SCoP (isl)' for region: 'bb8 => bb32' in function 'kernel_gemm':
|
||||
; CHECK: {
|
||||
; CHECK-NEXT: // 1st level tiling - Tiles
|
||||
; CHECK-NEXT: for (int c0 = 0; c0 <= 32; c0 += 1)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
; C[i][j] += alpha * A[i][k] * B[k][j];
|
||||
; }
|
||||
;
|
||||
; CHECK-LABEL: Printing analysis 'Polly - Generate an AST from the SCoP (isl)' for region: 'bb8 => bb32' in function 'kernel_gemm':
|
||||
; CHECK: {
|
||||
; CHECK-NEXT: // 1st level tiling - Tiles
|
||||
; CHECK-NEXT: for (int c0 = 0; c0 <= 32; c0 += 1)
|
||||
|
@ -76,6 +77,7 @@
|
|||
; CHECK-NEXT: }
|
||||
; CHECK-NEXT: }
|
||||
;
|
||||
; EXTRACTION-OF-MACRO-KERNEL-LABEL: Printing analysis 'Polly - Generate an AST from the SCoP (isl)' for region: 'bb8 => bb32' in function 'kernel_gemm':
|
||||
; EXTRACTION-OF-MACRO-KERNEL: {
|
||||
; EXTRACTION-OF-MACRO-KERNEL-NEXT: // 1st level tiling - Tiles
|
||||
; EXTRACTION-OF-MACRO-KERNEL-NEXT: for (int c0 = 0; c0 <= 32; c0 += 1)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
; checks whether they are tiled after being fused when polly-opt-fusion equals
|
||||
; "max".
|
||||
;
|
||||
; CHECK-LABEL: Printing analysis 'Polly - Generate an AST from the SCoP (isl)' for region: 'for.cond => for.end56' in function 'tf':
|
||||
; CHECK: 1st level tiling - Tiles
|
||||
; CHECK-NEXT: for (int c0 = 0; c0 <= 7; c0 += 1)
|
||||
; CHECK-NEXT: for (int c1 = 0; c1 <= 7; c1 += 1)
|
||||
|
|
Loading…
Reference in New Issue