This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Disable tail calls if callee does not preserve SVE regs.
ClosedPublic

Authored by sdesmalen on Jul 29 2020, 9:35 AM.

Details

Summary

This fixes an issue triggered by the following code, where emitEpilogue
got confused when trying to restore the SVE registers after the call,
whereas the call to bar() is implemented as a TCReturn:

int non_sve();
int sve(svint32_t x) { return non_sve(); }

Diff Detail

Event Timeline

sdesmalen created this revision.Jul 29 2020, 9:35 AM
Herald added a project: Restricted Project. · View Herald Transcript
sdesmalen requested review of this revision.Jul 29 2020, 9:35 AM
efriedma added inline comments.Jul 29 2020, 10:29 AM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
4172

I think it would be more clear to rewrite CallerCC the same way CalleeCC is rewritten, rather than write out the comparison like this.

sdesmalen updated this revision to Diff 281828.Jul 30 2020, 1:40 AM

Updated CallerCC to AArch64_SVE_VectorCall if the caller has an SVE signature.
The code that follows further on will automatically determine whether TCO can be usedby looking at the callee-saved regs preserved by the callee and caller (condition if (!CCMatch) { on line 4243)

sdesmalen marked an inline comment as done.Jul 30 2020, 1:40 AM
This revision is now accepted and ready to land.Jul 30 2020, 1:22 PM