[all-commits] [llvm/llvm-project] 35b388: [win/arm64] Enable tail call with inreg arguments ...

Hans Wennborg via All-commits all-commits at lists.llvm.org
Tue Apr 8 06:25:50 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 35b3886382f0172aa76bfbfc8e731e46c9c11cc3
      https://github.com/llvm/llvm-project/commit/35b3886382f0172aa76bfbfc8e731e46c9c11cc3
  Author: Hans Wennborg <hans at hanshq.net>
  Date:   2025-04-08 (Tue, 08 Apr 2025)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
    M llvm/test/CodeGen/AArch64/arm64-windows-tailcall.ll

  Log Message:
  -----------
  [win/arm64] Enable tail call with inreg arguments when possible (#134671)

Tail calls were disabled from callers with inreg parameters in 5dc8aeb
with a fixme to check if the callee also takes an inreg parameter.

The issue is that inreg parameters (which are passed in x0 or x1 for
free and member functions respectively) are supposed to be returned (in
x0) at the end of the function. In case of a tail call, that means the
callee needs to return the same value as the caller would.

We can check for that case, and it's not as niche as it sounds, as
that's how Clang will lower one function with an sret return value
calling another, such as:

```
struct T { int x; };
struct S {
    T foo();
    T bar();
};
T S::foo() { return bar(); } // foo's sret argument will get passed directly to bar
```

Fixes #133098



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list