[clang] [llvm] [CodeGen][arm64e] Add methods and data members to Address, which are needed to authenticate signed pointers (PR #67454)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 12 18:40:16 PST 2023
================
@@ -232,19 +232,19 @@ static Value *MakeBinaryAtomicValue(
static Value *EmitNontemporalStore(CodeGenFunction &CGF, const CallExpr *E) {
Value *Val = CGF.EmitScalarExpr(E->getArg(0));
- Value *Address = CGF.EmitScalarExpr(E->getArg(1));
+ Address Addr = CGF.EmitPointerWithAlignment(E->getArg(1));
Val = CGF.EmitToMemory(Val, E->getArg(0)->getType());
- LValue LV = CGF.MakeNaturalAlignAddrLValue(Address, E->getArg(0)->getType());
+ LValue LV = CGF.MakeAddrLValue(Addr, E->getArg(0)->getType());
LV.setNontemporal(true);
CGF.EmitStoreOfScalar(Val, LV, false);
return nullptr;
}
static Value *EmitNontemporalLoad(CodeGenFunction &CGF, const CallExpr *E) {
- Value *Address = CGF.EmitScalarExpr(E->getArg(0));
+ Address Addr = CGF.EmitPointerWithAlignment(E->getArg(0));
- LValue LV = CGF.MakeNaturalAlignAddrLValue(Address, E->getType());
+ LValue LV = CGF.MakeAddrLValue(Addr, E->getType());
----------------
efriedma-quic wrote:
EmitPointerWithAlignment tries to compute the alignment based on the underlying lvalue. This can be higher or lower than the natural alignment of the type. Say you have something like `vec f() { struct S { char c[16]; } x; return __temporal_load((vec*)x.c); }`. It looks through the cast, sees the field is unaligned, and therefore concludes the pointer is unaligned. This is arguably an improvement, but it's a significant change to the generated code.
https://github.com/llvm/llvm-project/pull/67454
More information about the cfe-commits
mailing list