[llvm] [llvm][AArch64] Search for a better PAUTH_EPILOGUE insertion point (PR #218783)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 13:54:40 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- llvm/lib/Target/AArch64/AArch64PointerAuth.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp b/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp
index a8e9bcff0..b5b870270 100644
--- a/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp
+++ b/llvm/lib/Target/AArch64/AArch64PointerAuth.cpp
@@ -336,8 +336,7 @@ void AArch64PointerAuthImpl::authenticateLR(
         BuildMI(MBB, MBBI, DL, TII->get(AArch64::PACM))
             .setMIFlag(MachineInstr::FrameDestroy);
       }
-      BuildMI(MBB, TI, DL,
-              TII->get(UseBKey ? AArch64::RETAB : AArch64::RETAA))
+      BuildMI(MBB, TI, DL, TII->get(UseBKey ? AArch64::RETAB : AArch64::RETAA))
           .copyImplicitOps(*MBBI)
           .setMIFlag(MachineInstr::FrameDestroy);
     }
@@ -357,7 +356,7 @@ void AArch64PointerAuthImpl::authenticateLR(
       break;
 
     if ((MI.getOpcode() == AArch64::ADDXri ||
-        MI.getOpcode() == AArch64::SUBXri) &&
+         MI.getOpcode() == AArch64::SUBXri) &&
         MI.getOperand(0).getReg() == AArch64::SP &&
         MI.getOperand(1).getReg() == AArch64::SP) {
       int64_t Imm = MI.getOperand(2).getImm()
@@ -395,7 +394,7 @@ void AArch64PointerAuthImpl::authenticateLR(
 
     if (NeedsWinCFI) {
       assert(UseBKey &&
-            "Windows SEH PAC unwind info only supports B-key signing");
+             "Windows SEH PAC unwind info only supports B-key signing");
       BuildMI(MBB, AutI.second, DL, TII->get(AArch64::SEH_PACSignLR))
           .setMIFlag(MachineInstr::FrameDestroy);
     }
@@ -411,9 +410,9 @@ void AArch64PointerAuthImpl::authenticateLR(
   // value, because the live arguments would fall below SP and potentially
   // outside the red-zone.
   //
-  // At this point there is an offset to the incoming SP, and we can't use the aut
-  // variants that hard-code SP. Reconstruct entry SP in x16 and authenticate
-  // using AUTI[AB]1716 (x17=LR, x16=entry_SP).
+  // At this point there is an offset to the incoming SP, and we can't use the
+  // aut variants that hard-code SP. Reconstruct entry SP in x16 and
+  // authenticate using AUTI[AB]1716 (x17=LR, x16=entry_SP).
   emitFrameOffset(MBB, AutI.second, DL, AArch64::X16, AArch64::SP,
                   StackOffset::getFixed(AutI.first), TII,
                   MachineInstr::FrameDestroy);
@@ -430,7 +429,8 @@ void AArch64PointerAuthImpl::authenticateLR(
     emitMOV(AArch64::X17, AArch64::LR);
 
     assert(PACSym && "No PAC instruction to refer to");
-    emitEpiloguePACSymOffsetIntoReg(*TII, MBB, AutI.second, DL, PACSym, AArch64::X15);
+    emitEpiloguePACSymOffsetIntoReg(*TII, MBB, AutI.second, DL, PACSym,
+                                    AArch64::X15);
 
     unsigned AutOpc = UseBKey ? AArch64::AUTIB171615 : AArch64::AUTIA171615;
     BuildMI(MBB, AutI.second, DL, TII->get(AutOpc))
@@ -442,7 +442,8 @@ void AArch64PointerAuthImpl::authenticateLR(
     emitMOV(AArch64::X17, AArch64::LR);
 
     assert(PACSym && "No PAC instruction to refer to");
-    emitEpiloguePACSymOffsetIntoReg(*TII, MBB, AutI.second, DL, PACSym, AArch64::X15);
+    emitEpiloguePACSymOffsetIntoReg(*TII, MBB, AutI.second, DL, PACSym,
+                                    AArch64::X15);
 
     // The PACM hint-space instruction modifies the following AUTI[AB]1716
     // to optionally take x15 as an extra operand depending on the
@@ -459,8 +460,8 @@ void AArch64PointerAuthImpl::authenticateLR(
 
     emitMOV(AArch64::LR, AArch64::X17);
   } else if (Subtarget->hasPAuth()) {
-    BuildMI(MBB, AutI.second, DL, TII->get(UseBKey ? AArch64::AUTIB : AArch64::AUTIA),
-            AArch64::LR)
+    BuildMI(MBB, AutI.second, DL,
+            TII->get(UseBKey ? AArch64::AUTIB : AArch64::AUTIA), AArch64::LR)
         .addUse(AArch64::LR)
         .addUse(AArch64::X16)
         .setMIFlag(MachineInstr::FrameDestroy);

``````````

</details>


https://github.com/llvm/llvm-project/pull/218783


More information about the llvm-commits mailing list