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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Dec 17 11:24:52 PST 2023


Author: Rik Huijzer
Date: 2023-12-17T20:24:47+01:00
New Revision: 6561efe142ae2a5d434ff646319b0bfb1dd39dee

URL: https://github.com/llvm/llvm-project/commit/6561efe142ae2a5d434ff646319b0bfb1dd39dee
DIFF: https://github.com/llvm/llvm-project/commit/6561efe142ae2a5d434ff646319b0bfb1dd39dee.diff

LOG: [mlir][python][nfc] Test `-print-ir-after-all` (#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.

---------

Co-authored-by: Maksim Levental <maksim.levental at gmail.com>

Added: 
    

Modified: 
    mlir/test/python/pass_manager.py

Removed: 
    


################################################################################
diff  --git a/mlir/test/python/pass_manager.py b/mlir/test/python/pass_manager.py
index 0face028b73ff1..43af80b53166cc 100644
--- a/mlir/test/python/pass_manager.py
+++ b/mlir/test/python/pass_manager.py
@@ -281,3 +281,36 @@ def testPostPassOpInvalidation():
         # CHECK:   return
         # CHECK: }
         log(module)
+
+
+# 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()
+        # CHECK: // -----// IR Dump Before Canonicalizer (canonicalize) ('builtin.module' operation) //----- //
+        # 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: module {
+        # CHECK:   func.func @main() {
+        # CHECK:     return
+        # CHECK:   }
+        # CHECK: }
+        pm.run(module)


        


More information about the Mlir-commits mailing list