[Mlir-commits] [mlir] [mlir][scf] Add simple LICM pattern for `scf.while` (PR #76370)

Mehdi Amini llvmlistbot at llvm.org
Sat Jan 6 03:07:42 PST 2024


joker-eph wrote:

> By that definition many optimizations can be considered a canonicalization but yet I don't think we would want to do them as part of canonicalizations. 

Like what?

> There are precedents where we decided to not do some transformation as canonicalizations as they are too opinionated. I think this is one of those cases.

Please elaborate: I'm on the opposite side and I don't quite perceive the reason here.
Not doing a canonicalization should be exceptional and very well motivated IMO. I'm wary of getting into being afraid of adding more canonicalization.


> My concern is that it won't be possible to consider the initial IR to decide whether some IR should be inside or outside the loop. It seems common for compilers to have some kind of cost model for LICM (or other code motion) and this will prevent that for all users.

I don't understand what you're trying to say here? What does it mean "initial IR"?

To me the input program to the compiler is "arbitrary", I don't put any value on the "initial IR" in term of being more "optimal". Doing so would break composability and goes entirely against the concept of canonicalization as I understand it.


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


More information about the Mlir-commits mailing list