[llvm] [LoongArch] Enable tail calls for sret functions and relax argument matching (PR #168506)

Folkert de Vries via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 02:39:38 PST 2025


folkertdev wrote:

> I also noticed that the byval argument test cases are still failing on LoongArch (and AArch64).

I'm not sure what you mean here.

Rust currently disallows a `become` on a function call that uses any `PassMode::Indirect` arguments. I want to relax that restriction to accept (what LLVM calls) `byval` arguments. 

However it turns out that many LLVM backends also do not support `byval` arguments correctly: the arm backends do support it now (I suspect since https://github.com/llvm/llvm-project/pull/109943), and I'll try to add support for x86_64 in https://github.com/llvm/llvm-project/pull/168956 by basically emulating the aarch64 approach. With loongarch (this PR), riscv (where we can basically copy this PR) and maybe powerpc/s390x (who have been quite responsive in fixing issues we run into) that should cover all of the major architectures I think.

---

What rust requires is a subset of musttail: we currently only allow sibcalls (so, ABI between caller and callee is a perfect match), but we want to support an arbitrary number of arguments, and want any rust type (that is FFI-safe/has a stable layout) to work as an argument.

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


More information about the llvm-commits mailing list