[Mlir-commits] [mlir] Add optional arguments to passmanger ir printing (PR #89301)

Maksim Levental llvmlistbot at llvm.org
Thu Apr 18 13:58:17 PDT 2024


================
@@ -44,8 +44,23 @@ MlirLogicalResult mlirPassManagerRunOnOp(MlirPassManager passManager,
   return wrap(unwrap(passManager)->run(unwrap(op)));
 }
 
-void mlirPassManagerEnableIRPrinting(MlirPassManager passManager) {
-  return unwrap(passManager)->enableIRPrinting();
+void mlirPassManagerEnableIRPrinting(MlirPassManager passManager,
+                                bool shouldPrintBeforePass,
+                                bool shouldPrintAfterPass,
+                                bool printAfterOnlyOnChange,
+                                bool printAfterOnlyOnFailure) {
+  auto shouldPrintBeforeFn = [shouldPrintBeforePass](Pass *, Operation *) {return shouldPrintBeforePass;};
+  auto shouldPrintAfterFn = [shouldPrintAfterPass](Pass *, Operation *) {return shouldPrintAfterPass;};
+ 
+  return unwrap(passManager)->enableIRPrinting(shouldPrintBeforeFn,
+                                                shouldPrintAfterFn,
+                                                true,
----------------
makslevental wrote:

I mean if you're gonna go through the trouble might as well make this a parameter as well and default it to true as well?

https://github.com/llvm/llvm-project/pull/89301


More information about the Mlir-commits mailing list