[Mlir-commits] [mlir] [MLIR] [Python] align python ir printing with mlir-print-ir-after-all (PR #107522)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Sep 17 19:01:53 PDT 2024
================
@@ -300,17 +300,43 @@ def testPrintIrAfterAll():
pm = PassManager.parse("builtin.module(canonicalize)")
ctx.enable_multithreading(False)
pm.enable_ir_printing()
- # CHECK: // -----// IR Dump Before Canonicalizer (canonicalize) ('builtin.module' operation) //----- //
+ # CHECK: // -----// IR Dump After Canonicalizer (canonicalize) //----- //
+ # CHECK: module {
+ # CHECK: func.func @main() {
+ # CHECK: return
+ # CHECK: }
+ # CHECK: }
+ pm.run(module)
+
+
+# CHECK-LABEL: TEST: testPrintIrBeforeAndAfterAll
+ at run
+def testPrintIrBeforeAndAfterAll():
+ with Context() as ctx:
+ module = ModuleOp.parse(
+ """
+ module {
+ func.func @main() {
+ %0 = arith.constant 10
+ return
+ }
+ }
+ """
+ )
+ pm = PassManager.parse("builtin.module(canonicalize)")
+ ctx.enable_multithreading(False)
+ pm.enable_ir_printing(print_before_all=True, print_after_all=True)
+ # CHECK: // -----// IR Dump Before Canonicalizer (canonicalize) //----- //
# CHECK: module {
# CHECK: func.func @main() {
# CHECK: %[[C10:.*]] = arith.constant 10 : i64
# CHECK: return
# CHECK: }
# CHECK: }
- # CHECK: // -----// IR Dump After Canonicalizer (canonicalize) ('builtin.module' operation) //----- //
+ # CHECK: // -----// IR Dump After Canonicalizer (canonicalize) //----- //
----------------
xurui1995 wrote:
In the previous `enable_ir_printing`, the default `print_module_scope` is true when calling `enableIRPrinting`, and it will print the `('builtin.module' operation)`, and now it was aligned with the `PassManagerOptions.cpp` with the false value.
https://github.com/llvm/llvm-project/pull/107522
More information about the Mlir-commits
mailing list