================
@@ -11800,6 +11796,16 @@ void 
AArch64InstrInfo::createPauthEpilogueInstr(MachineBasicBlock &MBB,
   RS.enterBasicBlockEnd(MBB);
   RS.backward(InsertPt);
 
+  bool MayCheckLR = Subtarget.getAuthenticatedLRCheckMethod(MF) !=
+                    AArch64PAuth::AuthCheckMethod::None;
+  if (ImplicitDefs.empty() && MayCheckLR) {
+    // If we may have to check LR at this point, we need a scratch register -
+    // try to pick a free one among X16 and X17.
+    Register ScratchRegForCheckVA =
+        LiveRegs.available(MRI, AArch64::X16) ? AArch64::X16 : AArch64::X17;
+    ImplicitDefs.push_back(ScratchRegForCheckVA);
+  }
----------------
vhscampos wrote:

If you decide to do the implicif-defs and spilling in InstrInfo, I'd try to do 
it only for the registers that are predetermined by the instructions, that is, 
we can't use any, we must use the ones set in stone in the instruction 
reference.

I don't exactly understand this CheckVA part, but if it can accept any register 
as a temporary, I'd suggest that you leave it out of the implicit-defs and 
perform the register scavenging in PointerAuth instead.

https://github.com/llvm/llvm-project/pull/220193
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to