[Mlir-commits] [mlir] [MLIR][SCF] fix scf.index_switch fold convergence (#98535) (PR #98680)

Matthias Springer llvmlistbot at llvm.org
Fri Jul 12 12:13:49 PDT 2024


https://github.com/matthias-springer approved this pull request.

I think the infinite loop could also be fixed by returning `failure()` from the folder in case the selected region is already empty. But I think the op is still not guaranteed to DCE away, so erasing it explicitly in a conversion pattern is better. Also, in my opinion, it's better to do such complex foldings (moving ops, etc.) in a canonicalization pattern through a rewriter, as an op movement could enable additional pattern matches in a greedy pattern rewrite. (Moving an op in the folder does not trigger any notifications and may even cause an `MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS` failure.)


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


More information about the Mlir-commits mailing list