[polly] 32bf468 - [Polly] Fix -polly-opt-isl -analyze
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 10 14:42:44 PDT 2020
Author: Michael Kruse
Date: 2020-07-10T16:42:03-05:00
New Revision: 32bf46842025b740de870dbcd446e4b0f203c9aa
URL: https://github.com/llvm/llvm-project/commit/32bf46842025b740de870dbcd446e4b0f203c9aa
DIFF: https://github.com/llvm/llvm-project/commit/32bf46842025b740de870dbcd446e4b0f203c9aa.diff
LOG: [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.
Added:
Modified:
polly/lib/Transform/ScheduleOptimizer.cpp
polly/test/ScheduleOptimizer/mat_mul_pattern_data_layout_2.ll
polly/test/ScheduleOptimizer/pattern-matching-based-opts_3.ll
polly/test/ScheduleOptimizer/tile_after_fusion.ll
Removed:
################################################################################
diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp b/polly/lib/Transform/ScheduleOptimizer.cpp
index d9dffb8f1f11..ebb596222a17 100644
--- a/polly/lib/Transform/ScheduleOptimizer.cpp
+++ b/polly/lib/Transform/ScheduleOptimizer.cpp
@@ -1389,7 +1389,7 @@ class IslScheduleOptimizer : public ScopPass {
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 @@ class IslScheduleOptimizer : public ScopPass {
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);
diff --git a/polly/test/ScheduleOptimizer/mat_mul_pattern_data_layout_2.ll b/polly/test/ScheduleOptimizer/mat_mul_pattern_data_layout_2.ll
index 7a645364c4bf..ef6a9f42adab 100644
--- a/polly/test/ScheduleOptimizer/mat_mul_pattern_data_layout_2.ll
+++ b/polly/test/ScheduleOptimizer/mat_mul_pattern_data_layout_2.ll
@@ -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)
diff --git a/polly/test/ScheduleOptimizer/pattern-matching-based-opts_3.ll b/polly/test/ScheduleOptimizer/pattern-matching-based-opts_3.ll
index 76341cb6afe0..b73083d196c8 100644
--- a/polly/test/ScheduleOptimizer/pattern-matching-based-opts_3.ll
+++ b/polly/test/ScheduleOptimizer/pattern-matching-based-opts_3.ll
@@ -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)
diff --git a/polly/test/ScheduleOptimizer/tile_after_fusion.ll b/polly/test/ScheduleOptimizer/tile_after_fusion.ll
index 42833ef97999..35f20ce5723d 100644
--- a/polly/test/ScheduleOptimizer/tile_after_fusion.ll
+++ b/polly/test/ScheduleOptimizer/tile_after_fusion.ll
@@ -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)
More information about the llvm-commits
mailing list