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

Markus Böck llvmlistbot at llvm.org
Sat Jan 6 03:36:03 PST 2024


zero9178 wrote:

+1 to what mehdi said.

Canonical to me doesn't have to mean more optimised, but rather that the IR is in a shape more useful for future transformations. LICM is a transformation helping in that regard as it makes loops more canonical (by getting closer to a loop only containing loop variant operations).
The fact that it increases register pressure is a backend detail. Since the input program may already contain a loop in "post-LICM" form you'll want a transformation sinking an operation into the loop either way (regardless of whether LICM is part of the pass pipeline or not).

That said, if it has quadratic complexity it should probably not be enabled in the canonicalize pass. I see canonicalize being used analogous to something like `InstSimplify` in LLVM and applied very often to ensure canonical IR throughout the pass pipeline.

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


More information about the Mlir-commits mailing list