[llvm] [LOH] Emit hints for LDP/STP instructions (PR #141297)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Fri May 23 15:55:35 PDT 2025


ellishg wrote:

I also noticed that we can get even more `.loh` directives if we support pre-indexed loads/stores. The only caveat is that we need to make sure to not change the base register in the load instruction because that base register might be used later on. So we must change the adrp register to `xB`. Also, note that post-indexed instructions will not work because the offset needs to be used to compute the address before the load/store operation (unless the offset ends up being zero, but that is a very specific edge case).

```
adrp xA, _foo at PAGE
add  xB, xA, _foo at PAGEOFF
ldr  xC, [xB, #off]!

adrp xB, _foo at PAGE
nop
ldr  xC, [xB, _foo at PAGEOFF + #off]!
```

I plan to first implement ldp/stp in LLD, then I will consider implementing this case.

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


More information about the llvm-commits mailing list