================ @@ -10685,6 +10689,26 @@ SDValue AArch64TargetLowering::LowerBR_JT(SDValue Op, return DAG.getNode(ISD::BRIND, DL, MVT::Other, JTInfo, SDValue(Dest, 0)); } +SDValue AArch64TargetLowering::LowerBRIND(SDValue Op, SelectionDAG &DAG) const { + MachineFunction &MF = DAG.getMachineFunction(); + std::optional<uint16_t> BADisc = + Subtarget->getPtrAuthBlockAddressDiscriminator(MF.getFunction()); + if (!BADisc) + return SDValue(); + + SDLoc DL(Op); + SDValue Chain = Op.getOperand(0); + SDValue Dest = Op.getOperand(1); + + SDValue Disc = DAG.getTargetConstant(*BADisc, DL, MVT::i64); + SDValue Key = DAG.getTargetConstant(AArch64PACKey::IA, DL, MVT::i32); + SDValue AddrDisc = DAG.getRegister(AArch64::XZR, MVT::i64); + + SDNode *BrA = DAG.getMachineNode(AArch64::BRA, DL, MVT::Other, ---------------- ahmedbougacha wrote:
Interesting, that explains it. I'd rather have the BR_JT survive as a BR_JT (or really, an AArch64 BR_JT that's analogous to ISD::BRIND, so that we can still do what we do on JumpTableDests), but that's a more serious change for the whole backend; let's do it separately. For now checking the target seems iffy but probably workable https://github.com/llvm/llvm-project/pull/97647 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits