This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][PAC] Remove the duplication of LR sign/auth implementations
ClosedPublic

Authored by atrosinenko on Aug 7 2023, 12:27 PM.

Details

Summary

In the machine outliner implementation for AArch64, signOutlinedFunction()
reimplements signing the LR value in prologue and authenticating it in
epilogue of the outlined function. This patch factors out signLR() and
authenticateLR() functions from AArch64FrameLowering code and reuses
them in signOutlinedFunction().

The mergeOutliningCandidateAttributes() outliner callback is
introduced as well to further unify signing and authentication of the LR
value.

Diff Detail

Event Timeline

atrosinenko created this revision.Aug 7 2023, 12:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 7 2023, 12:27 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
atrosinenko requested review of this revision.Aug 7 2023, 12:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 7 2023, 12:27 PM
atrosinenko planned changes to this revision.Aug 8 2023, 11:33 AM

Need to think a bit more if it is correct to just copy the PAuth-related function attributes in mergeOutliningCandidateAttributes - this would make it possible to pass less boolean arguments to signLR / authenticateLR.

atrosinenko added subscribers: ikudrin, olista01.

Rebased onto current main branch (after D156428). Further simplified the code by introducing the mergeOutliningCandidateAttributes() callback.

This did change the way how epilogue of an outlined function is emitted (no negate_ra_sign_state after AUTI(A|B)SP) but I hope it is a minor change.
The reason for async unwind info not being requested for an outlined function is the minsize function attribute (and, interestingly, the AArch64FunctionInfo::needsAsyncDwarfUnwindInfo() function explicitly mentions the case of an "outlined function" in its comment).

cc @olista01, @ikudrin

tmatheson accepted this revision.Aug 10 2023, 9:19 AM
tmatheson added a subscriber: tmatheson.

Funnily enough, I was working on exactly this. LGTM.

This revision is now accepted and ready to land.Aug 10 2023, 9:19 AM
atrosinenko retitled this revision from [AArch64][PAC] Remove duplication of LR sign/auth implementations to [AArch64][PAC] Remove the duplication of LR sign/auth implementations.Aug 11 2023, 2:58 AM
atrosinenko edited the summary of this revision. (Show Details)
This revision was landed with ongoing or failed builds.Aug 11 2023, 4:42 AM
This revision was automatically updated to reflect the committed changes.