[PATCH] D156358: [AArch64] Do not unnecessarily spill LR because of @llvm.returnaddress
Anatoly Trosinenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 31 06:53:21 PDT 2023
atrosinenko added a comment.
> https://github.com/ahmedbougacha/llvm-project/commit/7924c7d75ae0015a9fd9786a580b10b2190bccc6
>
> @atrosinenko do you want to try out that patch, see if it helps?
Actually, this patch is inspired by the above commit (the commit mentioned in my first message is the same, it was just referenced through `apple/llvm-project`). Turned out, most of its features were previously reimplemented in mainline in a way similar to your implementation but surprisingly not preventing your patch from being applied. The optimization of `@llvm.returnaddress` lowering was among a few features of 7924c7d75a not yet existing in mainline (the second feature is Darwin-specific optimization). In 7924c7d75a rebased onto recent mainline commit, it seems to have a minor issue of emitting extra `mov`s sometimes, like this:
_test_returnaddress_1: ; @test_returnaddress_1
; %bb.0:
stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
mov x29, sp
ldr x8, [x29]
ldr x8, [x8, #8]
mov x0, x8
xpaci x0
ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
ret
Anyway, now I wonder whether we should not touch `@llvm.returnaddress` lowering at all and adjust register allocation somehow (RET_ReallyLR definition, getRegAllocationHints method, something else...).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156358/new/
https://reviews.llvm.org/D156358
More information about the llvm-commits
mailing list