[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:06:55 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) //----- //
# CHECK: module {
# CHECK: func.func @main() {
# CHECK: return
# CHECK: }
# CHECK: }
- pm.run(module)
+ pm.run(module)
----------------
xurui1995 wrote:
added
https://github.com/llvm/llvm-project/pull/107522
More information about the Mlir-commits
mailing list