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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Dec 17 08:09:10 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Rik Huijzer (rikhuijzer)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/75742.diff


1 Files Affected:

- (modified) mlir/test/python/pass_manager.py (+23) 


``````````diff
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

``````````

</details>


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


More information about the Mlir-commits mailing list