This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Preserve X8 for thunks ending in variadic musttail calls
ClosedPublic

Authored by rnk on May 23 2019, 1:53 PM.

Details

Summary

On Windows, X8 may be used to pass in the address of an aggregate that
is returned indirectly. Therefore, it should be forwarded to variadic
musttail calls and preserved in thunks.

Fixes PR41997

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.May 23 2019, 1:53 PM
efriedma accepted this revision.May 23 2019, 4:38 PM

The varargs argument list for a function normally can't contain an sret parameter; I guess musttail vararg lists are special. Maybe worth calling out in the LangRef description of mustttail? (I guess you could argue that sret is an ABI issue which is inherently target-specific, but it still seems a little surprising.)

Otherwise LGTM

This revision is now accepted and ready to land.May 23 2019, 4:38 PM
rnk added a comment.May 23 2019, 6:25 PM

The varargs argument list for a function normally can't contain an sret parameter; I guess musttail vararg lists are special. Maybe worth calling out in the LangRef description of mustttail? (I guess you could argue that sret is an ABI issue which is inherently target-specific, but it still seems a little surprising.)

There was half a sentence in langref about forwarding varargs, but it was really meant to be a stronger guarantee. I added another bullet there, feel free to take a look and suggest improvements.

Otherwise LGTM

Thanks.

This revision was automatically updated to reflect the committed changes.
rnk added a comment.May 23 2019, 6:43 PM
In D62344#1515074, @rnk wrote:

There was half a sentence in langref about forwarding varargs, but it was really meant to be a stronger guarantee. I added another bullet there, feel free to take a look and suggest improvements.

This didn't make it into this commit, so I committed it in rL361590.