[Mlir-commits] [mlir] 42c413b - [mlir][Transforms] Preserve all analysis in print passes (#101315)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Jul 31 19:51:31 PDT 2024
Author: Hideto Ueno
Date: 2024-08-01T11:51:28+09:00
New Revision: 42c413b48917491efc5372752c6ad245530939f5
URL: https://github.com/llvm/llvm-project/commit/42c413b48917491efc5372752c6ad245530939f5
DIFF: https://github.com/llvm/llvm-project/commit/42c413b48917491efc5372752c6ad245530939f5.diff
LOG: [mlir][Transforms] Preserve all analysis in print passes (#101315)
PrintIRPass, PrintOpStatsPass and PrintOpGraphPass don't mutate IR so
preserve all analysis to save computation resource a bit.
Added:
Modified:
mlir/lib/Transforms/OpStats.cpp
mlir/lib/Transforms/PrintIR.cpp
mlir/lib/Transforms/ViewOpGraph.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Transforms/OpStats.cpp b/mlir/lib/Transforms/OpStats.cpp
index 6a71e1f02edc9..6746ed52396af 100644
--- a/mlir/lib/Transforms/OpStats.cpp
+++ b/mlir/lib/Transforms/OpStats.cpp
@@ -55,6 +55,7 @@ void PrintOpStatsPass::runOnOperation() {
printSummaryInJSON();
} else
printSummary();
+ markAllAnalysesPreserved();
}
void PrintOpStatsPass::printSummary() {
diff --git a/mlir/lib/Transforms/PrintIR.cpp b/mlir/lib/Transforms/PrintIR.cpp
index cc42c7e2f1db0..3c55f920dfd61 100644
--- a/mlir/lib/Transforms/PrintIR.cpp
+++ b/mlir/lib/Transforms/PrintIR.cpp
@@ -25,6 +25,7 @@ struct PrintIRPass : public impl::PrintIRPassBase<PrintIRPass> {
llvm::dbgs() << " " << this->label;
llvm::dbgs() << " //----- //\n";
getOperation()->dump();
+ markAllAnalysesPreserved();
}
};
diff --git a/mlir/lib/Transforms/ViewOpGraph.cpp b/mlir/lib/Transforms/ViewOpGraph.cpp
index b3c0a06c96fea..82e9863ab40bf 100644
--- a/mlir/lib/Transforms/ViewOpGraph.cpp
+++ b/mlir/lib/Transforms/ViewOpGraph.cpp
@@ -93,6 +93,7 @@ class PrintOpPass : public impl::ViewOpGraphBase<PrintOpPass> {
processOperation(getOperation());
emitAllEdgeStmts();
});
+ markAllAnalysesPreserved();
}
/// Create a CFG graph for a region. Used in `Region::viewGraph`.
More information about the Mlir-commits
mailing list