[Mlir-commits] [mlir] [mlir][reducer] Change mlir-reducer apply pattern logic (PR #195997)

lonely eagle llvmlistbot at llvm.org
Wed May 6 00:44:29 PDT 2026


linuxlonelyeagle wrote:

> @linuxlonelyeagle no worries, I don't have commit access yet. Thank you for pinging me here.
> 
> I don't believe this solves the core issue. Seems to me that this will cause segfault if both of these are true:

The core issue is that when the iterator increments, if the module is marked as 'uninteresting,' it gets cleared. This makes it impossible to perform a clone for the next step.

You can see the description of the PR.

> 1. The root module is interesting because of a trivially dead operation

That's a great example. However, there might be other contributing factors as well. The same issue might occur if you apply the fold method. Applying patterns to the entire module right from the start is too aggressive and has too broad an impact.

> 2. `eraseOpsNotInRange` is `false`

I'm not quite sure I follow you.

> With these changes, bug is pushed to a further point in the flow. So basically this can happen on second `findOptimal` invocation, specifically here: https://github.com/linuxlonelyeagle/llvm-project/blob/8d849fb6e4e84186ae86ca6055c1fe64b4f84804/mlir/lib/Reducer/ReductionTreePass.cpp#L207

As you can see, I have included test cases in this PR.

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


More information about the Mlir-commits mailing list