================ @@ -1012,25 +1014,37 @@ bool AArch64CallLowering::isEligibleForTailCallOptimization( } static unsigned getCallOpcode(const MachineFunction &CallerF, bool IsIndirect, - bool IsTailCall) { + bool IsTailCall, + std::optional<CallLowering::PointerAuthInfo> &PAI, + MachineRegisterInfo &MRI) { const AArch64FunctionInfo *FuncInfo = CallerF.getInfo<AArch64FunctionInfo>(); - if (!IsTailCall) - return IsIndirect ? getBLRCallOpcode(CallerF) : (unsigned)AArch64::BL; + if (!IsTailCall) { + if (!PAI) + return IsIndirect ? getBLRCallOpcode(CallerF) : (unsigned)AArch64::BL; + + assert(IsIndirect && "authenticated direct call"); + assert(PAI->Key == 0 || PAI->Key == 1 && "invalid ptrauth key"); + return AArch64::BLRA; + } if (!IsIndirect) return AArch64::TCRETURNdi; - // When BTI or PAuthLR are enabled, there are restrictions on using x16 and - // x17 to hold the function pointer. + // When BTI is enabled, we need to use TCRETURNriBTI to make sure that we use + // x16 or x17. if (FuncInfo->branchTargetEnforcement()) { - if (FuncInfo->branchProtectionPAuthLR()) + if (PAI) + return AArch64::AUTH_TCRETURN_BTI; + else if (FuncInfo->branchProtectionPAuthLR()) ---------------- kovdan01 wrote:
Do not use else after return https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return https://github.com/llvm/llvm-project/pull/85736 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits