[Mlir-commits] [mlir] [mlir][python][nfc] Test `-print-ir-after-all` (PR #75742)
Maksim Levental
llvmlistbot at llvm.org
Sun Dec 17 08:50:18 PST 2023
================
@@ -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)
----------------
makslevental wrote:
```suggestion
# 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:
# CHECK:
# CHECK: // -----// IR Dump After Canonicalizer (canonicalize) ('builtin.module' operation) //----- //
# CHECK: module {
# CHECK: func.func @main() {
# CHECK: return
# CHECK: }
# CHECK: }
pm.run(module)
```
Would definitely prefer this for an explicit illustration.
https://github.com/llvm/llvm-project/pull/75742
More information about the Mlir-commits
mailing list