[Mlir-commits] [mlir] 8dc790b - Add `//` before the banner displayed in `--print-ir-before/after-all`

Mehdi Amini llvmlistbot at llvm.org
Tue Apr 21 21:40:31 PDT 2020


Author: Mehdi Amini
Date: 2020-04-22T04:40:15Z
New Revision: 8dc790b9331eab1ba632aa7329d096db295d3348

URL: https://github.com/llvm/llvm-project/commit/8dc790b9331eab1ba632aa7329d096db295d3348
DIFF: https://github.com/llvm/llvm-project/commit/8dc790b9331eab1ba632aa7329d096db295d3348.diff

LOG: 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

Added: 
    

Modified: 
    mlir/lib/Pass/IRPrinting.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Pass/IRPrinting.cpp b/mlir/lib/Pass/IRPrinting.cpp
index b1792c497620..3398005d8bfa 100644
--- a/mlir/lib/Pass/IRPrinting.cpp
+++ b/mlir/lib/Pass/IRPrinting.cpp
@@ -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";


        


More information about the Mlir-commits mailing list