[Mlir-commits] [mlir] [mlir][scf] Revisit affected loops during range folding (PR #230961)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Oct 12 08:00:26 PDT 2026
Michael-Chen-NJU wrote:
> Thanks for the experiment. Can you address the `walk` comment and try again, looking at `applyOpPatternsGreedily`, `findCommonAncestor` can go quadratic if list on nested ops are passed.
Thanks! I've removed the explicit `walk` and switched to `applyPatternsGreedily` on the root op (`applyOpPatternsGreedily` with only the root doesn't visit nested `ForOp`s). All tests pass.
Unfortunately, the performance regression remains: the region-based greedy version took ~42s on the synthetic 1000-level nested-loop case, compared to ~0.2s with the targeted worklist.
Profiling the previous greedy version showed that `findCommonAncestor` took only ~4ms, while `isOpTriviallyDead` accounted for ~35s (~92% of runtime), due to repeated DCE checks on nested loops.
The region-based driver also removes unrelated dead operations. Would you prefer keeping the greedy approach despite these trade-offs, or reverting to the targeted worklist? Or is there any other ways to solve this regression?
https://github.com/llvm/llvm-project/pull/230961
More information about the Mlir-commits
mailing list