-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Arm64] tailcall bad codegen #36911
Comments
Here is a standalone repro:
You need to run it with
JitNoInline is needed because the inliner gets in the way of tailcall. |
We have the following IR:
Notice that for the tailcall arguments (the fast tailcall to So, what is the proper way to prevent this? Should LSRA avoid creating unspills of stack arguments in the argument list of outgoing fast tailcalls? (Or more specifically, unspills of stack arguments within the outgoing argument stack region of the fast tailcall?) Could a situation like this happen on other platforms? |
fwiw, I changed the default for
Coreclr pri-0 tests all pass (trying pri-1 now). Manually setting this back to 1 in the environment makes the problem go away. This variable is only used in |
@erozenfeld Fixed a related bug here: dotnet/coreclr#12200. |
Possibly related? #31729 |
#37192 fixes the standalone repro. |
LowerFastTailCall has code that looks for incoming stack arguments that may be overwritten by outgoing stack arguments and copies them to a temp. The logic was incorrect for Windows Arm64 because it was assuming shadow space, which only exists in Windows x64 abi. Fixes dotnet#31729. Fixes dotnet#36911.
Failure in libraries test System.Private.Uri.Tests:
e.g.:
JIT generates a tailcall to VerifyUriBuilder. It needs to copy 3rd stack argument arg10 to be the 1st stack argument of the tailcall. It moves the argument on the stack, trashing the stack argument arg8 before it is loaded into a register for the tailcall.
The text was updated successfully, but these errors were encountered: