llvm-project
16aa2833 - [MLIR] Refactor the walkAndApplyPatterns driver to remove the recursion (#154037)

Commit
123 days ago
[MLIR] Refactor the walkAndApplyPatterns driver to remove the recursion (#154037) This is in preparation of a follow-up change to stop traversing unreachable blocks. This is not NFC because of a subtlety of the early_inc. On a test case like: ``` scf.if %cond { "test.move_after_parent_op"() ({ "test.any_attr_of_i32_str"() {attr = 0 : i32} : () -> () }) : () -> () } ``` We recursively traverse the nested regions, and process an op when the region is done (post-order). We need to pre-increment the iterator before processing an operation in case it gets deleted. However we can do this before or after processing the nested region. This implementation does the latter.
Author
Parents
Loading