[llvm] [AArch64] Optimization of repeated constant loads (#51483) (PR #86249)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 28 16:56:57 PDT 2024


efriedma-quic wrote:

> Is it worth doing that first, then this could be simplified a little to just having to look at str(or(x, x, lsl 32)).

This handles some cases, but not all.  Consider:

```
void f(long long *A) {
   *A = 0xC2000000C2000000;
}

long long f2() {
    return 0xC2000000C2000000;
}
```

You want mov+stp for the store... but you don't want to generate orr for the return.  (Even for the cases where we generate three instructions, we're going to avoid "orr(x, x, lsl 32)" where we can because it's more expensive than movk.)

Maybe we should run this optimization before pseudo-expansion?

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


More information about the llvm-commits mailing list