Skip to content

Commit 8dc790b

Browse files
committed
Add // before the banner displayed in --print-ir-before/after-all
This is making the output file (when the stream is a file) a valid MLIR file. Differential Revision: https://reviews.llvm.org/D78604
1 parent 46a52ff commit 8dc790b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mlir/lib/Pass/IRPrinting.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void IRPrinterInstrumentation::runBeforePass(Pass *pass, Operation *op) {
141141
beforePassFingerPrints.try_emplace(pass, op);
142142

143143
config->printBeforeIfEnabled(pass, op, [&](raw_ostream &out) {
144-
out << formatv("*** IR Dump Before {0} ***", pass->getName());
144+
out << formatv("// *** IR Dump Before {0} ***", pass->getName());
145145
printIR(op, config->shouldPrintAtModuleScope(), out, OpPrintingFlags());
146146
out << "\n\n";
147147
});
@@ -165,7 +165,7 @@ void IRPrinterInstrumentation::runAfterPass(Pass *pass, Operation *op) {
165165
}
166166

167167
config->printAfterIfEnabled(pass, op, [&](raw_ostream &out) {
168-
out << formatv("*** IR Dump After {0} ***", pass->getName());
168+
out << formatv("// *** IR Dump After {0} ***", pass->getName());
169169
printIR(op, config->shouldPrintAtModuleScope(), out, OpPrintingFlags());
170170
out << "\n\n";
171171
});
@@ -178,7 +178,7 @@ void IRPrinterInstrumentation::runAfterPassFailed(Pass *pass, Operation *op) {
178178
beforePassFingerPrints.erase(pass);
179179

180180
config->printAfterIfEnabled(pass, op, [&](raw_ostream &out) {
181-
out << formatv("*** IR Dump After {0} Failed ***", pass->getName());
181+
out << formatv("// *** IR Dump After {0} Failed ***", pass->getName());
182182
printIR(op, config->shouldPrintAtModuleScope(), out,
183183
OpPrintingFlags().printGenericOpForm());
184184
out << "\n\n";

0 commit comments

Comments
 (0)