[Mlir-commits] [mlir] [mlir][scf] Add simple LICM pattern for `scf.while` (PR #76370)
Ivan Butygin
llvmlistbot at llvm.org
Fri Jan 19 17:16:33 PST 2024
Hardcode84 wrote:
> or even (for example) interleave CSE and canonicalization until fixed-point?
Yes, and we did it downstream in kind of generic way https://github.com/numba/numba-mlir/blob/main/mlir/lib/Transforms/CompositePass.cpp but there is nothing like this upstream :)
Anyways, I can close this PR an continue with main PR (https://github.com/llvm/llvm-project/pull/76108), making a test pass first, and then making it canonicalization in separate PR.
Also, I'll need to add another pattern which is most likely not qualifies as canonicalization, transforming:
```
%res = scf.while() {
before:
%1 = foo.bar()
condition %cond, %1
after(%arg):
use %arg
}
use %res
```
to
```
scf.while() {
before:
condition %cond
after():
%arg = foo.bar()
use %arg
}
%res = foo.bar()
use %res
```
I initially wanted to add it to uplifting pass itself, but if it will be gone, we probably need another separate pass.
https://github.com/llvm/llvm-project/pull/76370
More information about the Mlir-commits
mailing list