[flang-commits] [flang] [mlir] [MLIR] Refactor DCE helper to expose worklist entry-point, and use this helper in CSE (PR #195636)

lonely eagle via flang-commits flang-commits at lists.llvm.org
Tue May 5 02:24:09 PDT 2026


linuxlonelyeagle wrote:

> > I think we are heading to a good refactor direction here.
> 
> I've been hesitant about this though: is the complexity really worth it here?
> 
> Since this is about ops that are trivially dead in the original program, do we really need to tangle this complex bookkeeping to be able to perform a single IR traversal or should we just have a separate IR traversal delegated to eliminateTriviallyDeadOps? The whole logic propagating the trivially dead ops in the parent worklist is not straightforward, and none of this enables any use-case on top of running `trivial-dce` in the first place.

I’ve had a general look at the implementation, and here's my overall take on the PR: To be honest, the current approach feels a bit forced. I personally would prefer https://github.com/llvm/llvm-project/pull/193778.

To be honest, one reason I prefer it is that I wrote it. But more importantly, I believe it’s simple, straightforward, and natural. As you can see, it only adds a few dozen lines of code. While I understand the desire for maximum reusability, I'm concerned it might introduce unnecessary complexity.

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


More information about the flang-commits mailing list