[llvm] [AArch64][PAC] Select auth+load into LDRAA/LDRAB/LDRA[pre]. (PR #123769)

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 08:56:06 PST 2025


================
@@ -1671,6 +1673,163 @@ bool AArch64DAGToDAGISel::tryIndexedLoad(SDNode *N) {
   return true;
 }
 
+bool AArch64DAGToDAGISel::tryAuthLoad(SDNode *N) {
+  LoadSDNode *LD = cast<LoadSDNode>(N);
+  EVT VT = LD->getMemoryVT();
+  if (VT != MVT::i64)
+    return false;
+
+  assert(LD->getExtensionType() == ISD::NON_EXTLOAD && "invalid 64bit extload");
+
+  ISD::MemIndexedMode AM = LD->getAddressingMode();
+  if (AM != ISD::PRE_INC && AM != ISD::UNINDEXED)
+    return false;
+  bool IsPre = AM == ISD::PRE_INC;
+
+  SDValue Chain = LD->getChain();
+  SDValue Ptr = LD->getBasePtr();
----------------
atrosinenko wrote:

I think, `Ptr` variable deserves a `const` modifier and a comment explaining that it is the value that is replaced by the written back pre-incremented address. This would answer the question "When writing the address back merely to store it in authenticated form, how the offset is handled?" - "No adjustment needed, the offset was already there".

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


More information about the llvm-commits mailing list