[Mlir-commits] [mlir] [vector][mlir] Canonicalize to shape_cast where possible (PR #140583)
Mehdi Amini
llvmlistbot at llvm.org
Tue Oct 21 09:36:09 PDT 2025
joker-eph wrote:
> There is no justification in this PR that canonicalizing towards a single operation makes subsequent analysis and optimizations more effective.
"In general" having to match a single form for the same program is what makes subsequent analysis more effective: that is we can match a single "thing" instead of needing to match many. So this sentence as-is is a bit odd to me (but you're elaborating pretty well in the rest of your post!).
That said it does not mean "one op", it just means "pick a direction and stick to it". For InstCombine for a while it was something like (from memory) "if a form has less number of operations or less SSA values in flight, then it's 'simpler'".
It's very valid to consider than one form is "more structured" than the other, but usually the conclusion is that this form is the more canonical one and the canonicalization should go the other direction. In then end: "one form is preferable to many" is the underlying mindset.
https://github.com/llvm/llvm-project/pull/140583
More information about the Mlir-commits
mailing list