This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SME] Disable tail-call optimization when streaming mode change or lazy-save may be required.
ClosedPublic

Authored by sdesmalen on Aug 10 2022, 8:42 AM.

Details

Summary

When a streaming mode change is (or may be) required for a call, it will
need to restore the original mode after the call, which prevents the use of
tail-call optimization. The same holds true for a call that requires the lazy-save
mechanism to be set up before the call, and possibly restored after.

More details about the SME attributes and design can be found
in D131562.

Diff Detail

Event Timeline

sdesmalen created this revision.Aug 10 2022, 8:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2022, 8:42 AM
sdesmalen requested review of this revision.Aug 10 2022, 8:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2022, 8:42 AM
aemerson added inline comments.
llvm/test/CodeGen/AArch64/sme-shared-za-interface.ll
8–10

This is correct as long as you have the shared-za attribute right?

sdesmalen added inline comments.Sep 16 2022, 3:25 AM
llvm/test/CodeGen/AArch64/sme-shared-za-interface.ll
8–10

Sorry, I missed this comment. The code below is only correct if @private_za_callee also has aarch64_pstate_za_shared, but in this case it isn't, which means that the call to @private_za_callee could clobber ZA. It would need the lazy-save mechanism (implemented in D133900)

sdesmalen retitled this revision from [AArch64][SME] Disable tail-call optimization when streaming mode change may be required. to [AArch64][SME] Disable tail-call optimization when streaming mode change or lazy-save may be required..Sep 16 2022, 3:27 AM
sdesmalen edited the summary of this revision. (Show Details)
Matt added a subscriber: Matt.Sep 16 2022, 11:42 AM
aemerson accepted this revision.Sep 16 2022, 1:52 PM
aemerson added inline comments.
llvm/test/CodeGen/AArch64/sme-shared-za-interface.ll
8–10

Right, of course.

This revision is now accepted and ready to land.Sep 16 2022, 1:52 PM
This revision was landed with ongoing or failed builds.Sep 17 2022, 9:22 AM
This revision was automatically updated to reflect the committed changes.