Cranelift AArch64: Fix the get_return_address lowering#4851
Conversation
cfallin
left a comment
There was a problem hiding this comment.
Thanks! One request for an additional comment below.
At the top level, so I understand correctly: the verifier already ensures that this op can only be used when preserve_frame_pointers is true; so the additional conditions here are to document that / ensure it remains the case?
If so, as another extra assurance, it may be good to put a comment by the verifier check (linked above) indicating that backends may rely on this to be true and the check should not be loosened without auditing all backends.
Thanks!
Yes, I added the check as an additional safety net, and your suggestion to write a comment next to the verifier check makes perfect sense, thanks! |
The previous implementation assumed that nothing had clobbered the LR register since the current function had started executing, so it would be incorrect for a non-leaf function, for example, that contains the `get_return_address` operation right after a call. The operation is valid only if the `preserve_frame_pointers` flag is enabled, which implies that the presence of a frame record on the stack is guaranteed. Copyright (c) 2022, Arm Limited.
46e3ec2 to
4b0847d
Compare
The previous implementation assumed that nothing had clobbered the LR register since the current function had started executing, so it would be incorrect for a non-leaf function, for example, that contains the
get_return_addressoperation right after a call. The operation is valid only if thepreserve_frame_pointersflag is enabled, which implies that the presence of a frame record on the stack is guaranteed.