[Mlir-commits] [mlir] [mlir][scf] Add simple LICM pattern for `scf.while` (PR #76370)
Mehdi Amini
llvmlistbot at llvm.org
Sat Jan 6 04:46:55 PST 2024
joker-eph wrote:
> Now, back to this PR, I agree with @joker-eph here: LICM, even a simplified version, isn't canonicalization, it's a transformation.
Actually you're saying the opposite of me :)
I'm saying that:
```
for (auto value : vector) {
int a = f(x, y, z); // loop invariant
g(value, a);
}
```
and:
```
int a = f(x, y, z); // loop invariant
for (auto value : vector) {
g(value, a);
}
```
Are equivalent programs, and the argument that the second one "may increase register pressure" (for example, use any kind of target-specific optimization) is not a valid objection to canonicalization.
https://github.com/llvm/llvm-project/pull/76370
More information about the Mlir-commits
mailing list