Skip to content

Commit 6561efe

Browse files
[mlir][python][nfc] Test -print-ir-after-all (#75742)
The functionality to `-print-ir-after-all` was added in caa159f. This PR adds a test and, with that, some documentation. --------- Co-authored-by: Maksim Levental <[email protected]>
1 parent 6655581 commit 6561efe

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

mlir/test/python/pass_manager.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,36 @@ def testPostPassOpInvalidation():
281281
# CHECK: return
282282
# CHECK: }
283283
log(module)
284+
285+
286+
# CHECK-LABEL: TEST: testPrintIrAfterAll
287+
@run
288+
def testPrintIrAfterAll():
289+
with Context() as ctx:
290+
module = ModuleOp.parse(
291+
"""
292+
module {
293+
func.func @main() {
294+
%0 = arith.constant 10
295+
return
296+
}
297+
}
298+
"""
299+
)
300+
pm = PassManager.parse("builtin.module(canonicalize)")
301+
ctx.enable_multithreading(False)
302+
pm.enable_ir_printing()
303+
# CHECK: // -----// IR Dump Before Canonicalizer (canonicalize) ('builtin.module' operation) //----- //
304+
# CHECK: module {
305+
# CHECK: func.func @main() {
306+
# CHECK: %[[C10:.*]] = arith.constant 10 : i64
307+
# CHECK: return
308+
# CHECK: }
309+
# CHECK: }
310+
# CHECK: // -----// IR Dump After Canonicalizer (canonicalize) ('builtin.module' operation) //----- //
311+
# CHECK: module {
312+
# CHECK: func.func @main() {
313+
# CHECK: return
314+
# CHECK: }
315+
# CHECK: }
316+
pm.run(module)

0 commit comments

Comments
 (0)