[Mlir-commits] [mlir] [mlir][scf] Add simple LICM pattern for `scf.while` (PR #76370)
Thomas Raoux
llvmlistbot at llvm.org
Fri Jan 5 09:31:58 PST 2024
ThomasRaoux wrote:
> > I don't think LICM should belong to canonicalization. LICM is not always good for code quality as it may increase register pressure so applying it blindly during canonicalization seems dangerous.
>
> I don't see a contraction between what you're saying and the canonicalization.
>
> The process of canonicalization isn't to make the code faster, it is to make two equivalent input programs with the same IR.
>
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. 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.
> It is expected that a cost-model and target specific lowering has to do some scheduling, and likely undo some potential canonicalizations.
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.
https://github.com/llvm/llvm-project/pull/76370
More information about the Mlir-commits
mailing list