[PATCH] D77565: [AArch64] Remove implicit landing pads.

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 01:36:10 PDT 2020


chill added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64FrameLowering.cpp:940
   if (ShouldSignReturnAddress(MF)) {
-    if (ShouldSignWithAKey(MF))
-      BuildMI(MBB, MBBI, DL, TII->get(AArch64::PACIASP))
-          .setMIFlag(MachineInstr::FrameSetup);
-    else {
+    if (ShouldSignWithAKey(MF)) {
+      if (Subtarget.hasV8_3aOps()) {
----------------
> Why not create the PACI[AB] from the very start, with a comment why are we doing it?

Sorry, I meant do say, create in the prologue:
* `PACIA` if we do know the function should/can not be called indirectly and  "branch-target-enforcement" attribute is present (if it's absent, it doesn't matter which insn we emit, right?)
*  `PACIASP` otherwise

Then this BTI placrement pass could just check

    if (MBBI->getOpcode() == AArch64::PACIASP ||
      MBBI->getOpcode() == AArch64::PACIBSP ||
      MBBI->getOpcode() == AArch64::PACIA ||
       MBBI->getOpcode() == AArch64::PACIB) 
      return false;

knowing that what needs to be done has already been done.



================
Comment at: llvm/lib/Target/AArch64/AArch64FrameLowering.cpp:941
+    if (ShouldSignWithAKey(MF)) {
+      if (Subtarget.hasV8_3aOps()) {
+        BuildMI(MBB, MBBI, DL, TII->get(AArch64::PACIA))
----------------
Could this be refactored in a separate function and shared with the similar code that signs outlined functions?



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

https://reviews.llvm.org/D77565





More information about the llvm-commits mailing list