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
This commit is contained in:
Mehdi Amini 2020-04-22 00:31:59 +00:00
parent 46a52ff9ed
commit 8dc790b933

View File

@ -141,7 +141,7 @@ void IRPrinterInstrumentation::runBeforePass(Pass *pass, Operation *op) {
beforePassFingerPrints.try_emplace(pass, op);
config->printBeforeIfEnabled(pass, op, [&](raw_ostream &out) {
out << formatv("*** IR Dump Before {0} ***", pass->getName());
out << formatv("// *** IR Dump Before {0} ***", pass->getName());
printIR(op, config->shouldPrintAtModuleScope(), out, OpPrintingFlags());
out << "\n\n";
});
@ -165,7 +165,7 @@ void IRPrinterInstrumentation::runAfterPass(Pass *pass, Operation *op) {
}
config->printAfterIfEnabled(pass, op, [&](raw_ostream &out) {
out << formatv("*** IR Dump After {0} ***", pass->getName());
out << formatv("// *** IR Dump After {0} ***", pass->getName());
printIR(op, config->shouldPrintAtModuleScope(), out, OpPrintingFlags());
out << "\n\n";
});
@ -178,7 +178,7 @@ void IRPrinterInstrumentation::runAfterPassFailed(Pass *pass, Operation *op) {
beforePassFingerPrints.erase(pass);
config->printAfterIfEnabled(pass, op, [&](raw_ostream &out) {
out << formatv("*** IR Dump After {0} Failed ***", pass->getName());
out << formatv("// *** IR Dump After {0} Failed ***", pass->getName());
printIR(op, config->shouldPrintAtModuleScope(), out,
OpPrintingFlags().printGenericOpForm());
out << "\n\n";