[PATCH] D69097: [AArch64][MachineOutliner] Return address signing for outlined functions

David Tellenbach via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 06:43:38 PDT 2019


tellenbach added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:5129
+  if (FCF.hasFnAttribute("sign-return-address")) {
+    NumBytesToCreateFrame += 8;
+  }
----------------
ostannard wrote:
> tellenbach wrote:
> > This is actually an assumption: If the candidates agree on `"sign-return-address"="non-leaf"`, the outlined function could potentially get signed. (and the outlined function could potentially increase by two instructions). However, it is not certainly true that it will be no leaf function (and hence needs no signing), This gets determined later when the decision to outline or not is already made.
> I think this would be useful as a comment.
> 
> Could we also check if we have the v8.3A instructions here, as using RETAA will reduce the size bloat by 4 bytes?
The problem here is the same: Here we only know whether `RETAA/RETAB` instructions are available, not if we really can use them. E.g. in the case of a tail calling outlined function we rather emit a branch than a return and therefore can't replace the `RET` by `RETAA/RETAB`. The signing falls back to `AUTIASP/AUTIBSP` in this case.

However, the decision to tail-call or not is made later, when the decision to outline has already been made.

Assuming 2 instructions is therefore the only safe way I see.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69097/new/

https://reviews.llvm.org/D69097





More information about the llvm-commits mailing list