Skip to content

Commit 42c413b

Browse files
authored
[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.
1 parent 9227fd7 commit 42c413b

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

mlir/lib/Transforms/OpStats.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ void PrintOpStatsPass::runOnOperation() {
5555
printSummaryInJSON();
5656
} else
5757
printSummary();
58+
markAllAnalysesPreserved();
5859
}
5960

6061
void PrintOpStatsPass::printSummary() {

mlir/lib/Transforms/PrintIR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct PrintIRPass : public impl::PrintIRPassBase<PrintIRPass> {
2525
llvm::dbgs() << " " << this->label;
2626
llvm::dbgs() << " //----- //\n";
2727
getOperation()->dump();
28+
markAllAnalysesPreserved();
2829
}
2930
};
3031

mlir/lib/Transforms/ViewOpGraph.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class PrintOpPass : public impl::ViewOpGraphBase<PrintOpPass> {
9393
processOperation(getOperation());
9494
emitAllEdgeStmts();
9595
});
96+
markAllAnalysesPreserved();
9697
}
9798

9899
/// Create a CFG graph for a region. Used in `Region::viewGraph`.

0 commit comments

Comments
 (0)