[Mlir-commits] [mlir] [mlir] Enhance dimOp fold (PR #187286)

Mehdi Amini llvmlistbot at llvm.org
Sat Mar 28 02:47:47 PDT 2026


joker-eph wrote:

> To summarize basically this does not handle case where dim resolution result in a "DAG" of operations, and always materializes a "Tree" of operations. so every time you reach the same node through different paths, it will materialize the node redundantly, and that can exponentially increase the compilation time.

I don't follow, do you have an example that would make it more concrete?

The class of pattern I was referring to (and glancing at the current diff, they seem to fit) are performing direct replacements, and I don't quite foresee how this could lead to redundancies? 
For example the `DimOfExpandShapeOp` eliminates entirely the `dim` op and replace it with either a constant of the input value of the expandShape.

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


More information about the Mlir-commits mailing list