[Mlir-commits] [mlir] [mlir][python][nfc] Test `-print-ir-after-all` (PR #75742)

Rik Huijzer llvmlistbot at llvm.org
Sun Dec 17 08:08:39 PST 2023


https://github.com/rikhuijzer created https://github.com/llvm/llvm-project/pull/75742

The functionality to `-print-ir-after-all` was added in https://github.com/llvm/llvm-project/commit/caa159f044a05f782701a525d8b0e8f346abbd64. This PR adds a test and, with that, some documentation.

>From c09ccdaf6546cd18fe3c3b2df376a690f549539e Mon Sep 17 00:00:00 2001
From: Rik Huijzer <github at huijzer.xyz>
Date: Sun, 17 Dec 2023 17:04:17 +0100
Subject: [PATCH] [mlir][python] Add test for `-print-ir-after-all`

---
 mlir/test/python/pass_manager.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/mlir/test/python/pass_manager.py b/mlir/test/python/pass_manager.py
index 0face028b73ff1..ef12e47c0c8c7a 100644
--- a/mlir/test/python/pass_manager.py
+++ b/mlir/test/python/pass_manager.py
@@ -281,3 +281,26 @@ def testPostPassOpInvalidation():
         # CHECK:   return
         # CHECK: }
         log(module)
+
+
+# Test -print-ir-after-all.
+# CHECK-LABEL: TEST: testPrintIrAfterAll
+ at run
+def testPrintIrAfterAll():
+    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()
+        pm.run(module)
+        log(module)
+        # CHECK: IR Dump After Canonicalizer



More information about the Mlir-commits mailing list