[clang] [llvm] [ARM] Fix musttail calls (PR #109943)
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 26 09:37:54 PDT 2024
rnk wrote:
By the way, the x86 backend also miscompiles test cases like this:
```
struct ByVal { int large[5]; };
void f(ByVal a, ByVal b);
void g(ByVal a, ByVal b) {
[[clang::musttail]] f(b, a);
}
```
I have an internal issue assigned to @aeubanks tracking that. I may have reported it upstream. It should be looked into. It uses the analogous copy-pasted "MatchingStackOffset" helpers which have been removed in this change, and any technique used for ARM is probably applicable to x86.
I think we'd get decent code by doing a sequence of `LOAD <all outgoing byval bytes to vregs> ; TOKENFACTOR ; STORE <all vregs to byval argument slots>`. This would allow the register allocator to use the register file as temporary storage to implement the swap, instead of having to conservatively allocate temporary stack space to copy every outgoing byval arguement, or implement complicated aliasing rules to avoid the need to do that.
https://github.com/llvm/llvm-project/pull/109943
More information about the cfe-commits
mailing list