================ @@ -4467,17 +4467,25 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_trivially_relocate: case Builtin::BImemmove: case Builtin::BI__builtin_memmove: { + QualType CopiedType = E->getArg(0)->getType()->getPointeeType(); Address Dest = EmitPointerWithAlignment(E->getArg(0)); Address Src = EmitPointerWithAlignment(E->getArg(1)); Value *SizeVal = EmitScalarExpr(E->getArg(2)); - if (BuiltinIDIfNoAsmLabel == Builtin::BI__builtin_trivially_relocate) + if (BuiltinIDIfNoAsmLabel == Builtin::BI__builtin_trivially_relocate) { + QualType BaseElementType = getContext().getBaseElementType(CopiedType); + if (getContext().containsAddressDiscriminatedPointerAuth( + BaseElementType)) { + llvm::Instruction *LastFixupInstruction = + EmitPointerAuthRelocationFixup(CopiedType, Dest, Src, SizeVal); + addInstToNewSourceAtom(LastFixupInstruction, nullptr); ---------------- ojhunt wrote:
I was so confused by this comment, to the extent I thought I had managed to break this and not catch it, but yet I agree now the name should be changed :D When I first wrote this the memmove was not part of that function, so it was purely a fixup, but that is obviously no longer the case. https://github.com/llvm/llvm-project/pull/144420 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits