[llvm] [PAC][IR][AArch64] Add "ptrauth(...)" Constant to represent signed pointers. (PR #85738)

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 10:43:25 PDT 2024


================
@@ -3596,6 +3609,21 @@ Error BitcodeReader::parseConstants() {
                                   Record[1]);
       break;
     }
+    case bitc::CST_CODE_SIGNED_PTR: {
+      if (Record.size() < 6)
+        return error("Invalid record");
+      Type *PtrTy = getTypeByID(Record[0]);
+      if (!PtrTy)
+        return error("Invalid record");
+
+      // PtrTy, Ptr, Key, AddrDiscTy, AddrDisc, Disc
+      V = BitcodeConstant::create(
+        Alloc, CurTy, BitcodeConstant::ConstantPtrAuthOpcode,
+        {(unsigned)Record[1], (unsigned)Record[2], (unsigned)Record[4],
+         (unsigned)Record[5]});
----------------
ahmedbougacha wrote:

Yeah, we don't need either address discriminator type nor base pointer type, I think.  I removed both and added a couple tests and a verifier check for the potentially-relevant cases

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


More information about the llvm-commits mailing list