aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2025-09-10 19:27:25 -0700
committerPeter Collingbourne <peter@pcc.me.uk>2025-09-10 19:27:25 -0700
commit76a68c1385b97fcfccfcd40ab43e3376a2445ffe (patch)
treedaf4a8108e9d1c120afff449f6a7aa25e42fdbad
parentccf26e07c7bbd5fbf734294093b226c741d7eb03 (diff)
parente3a705ade26d1e70798588be959d97fc7fc5d3d1 (diff)
downloadllvm-users/pcc/spr/add-pointer-field-protection-feature.zip
llvm-users/pcc/spr/add-pointer-field-protection-feature.tar.gz
llvm-users/pcc/spr/add-pointer-field-protection-feature.tar.bz2
Remove special case for forwarding lambdausers/pcc/spr/add-pointer-field-protection-feature
Created using spr 1.3.6-beta.1
-rw-r--r--clang/lib/CodeGen/CGClass.cpp10
-rw-r--r--clang/test/CodeGenCXX/trivial_abi.cpp4
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp2
3 files changed, 5 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index 28fd20a..fd99202 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -2994,15 +2994,7 @@ void CodeGenFunction::EmitForwardingCallToLambda(
QualType resultType = FPT->getReturnType();
ReturnValueSlot returnSlot;
if (!resultType->isVoidType() &&
- (calleeFnInfo->getReturnInfo().getKind() == ABIArgInfo::Indirect ||
- // With pointer field protection, we need to set up the return slot when
- // returning an object with trivial ABI to avoid the memcpy that would
- // otherwise be generated by the call to EmitReturnOfRValue() below, as
- // that may corrupt the pointer signature. It doesn't hurt to do this all
- // the time as it results in slightly simpler codegen.
- (resultType->isRecordType() &&
- resultType->getAsCXXRecordDecl()
- ->hasTrivialCopyConstructorForCall())) &&
+ calleeFnInfo->getReturnInfo().getKind() == ABIArgInfo::Indirect &&
!hasScalarEvaluationKind(calleeFnInfo->getReturnType()))
returnSlot =
ReturnValueSlot(ReturnValue, resultType.isVolatileQualified(),
diff --git a/clang/test/CodeGenCXX/trivial_abi.cpp b/clang/test/CodeGenCXX/trivial_abi.cpp
index a637fdd..eacbde5 100644
--- a/clang/test/CodeGenCXX/trivial_abi.cpp
+++ b/clang/test/CodeGenCXX/trivial_abi.cpp
@@ -283,9 +283,11 @@ static_assert(sizeof(S) == 8 && sizeof(S2) == 8, "");
// CHECK: define{{.*}} @"_ZN3$_08__invokeEv"()
// CHECK: %[[RETVAL:.*]] = alloca %[[STRUCT_SMALL]], align 8
+// CHECK: %[[COERCE:.*]] = alloca %[[STRUCT_SMALL]], align 8
// CHECK: %[[CALL:.*]] = call{{.*}} @"_ZNK3$_0clEv"
-// CHECK: %[[RETVALDIVE:.*]] = getelementptr{{.*}} %[[RETVAL]]
+// CHECK: %[[COERCEDIVE:.*]] = getelementptr{{.*}} %[[COERCE]]
// CHECK: %[[COERCEVALIP:.*]] = inttoptr{{.*}} %[[CALL]]
+// CHECK: call {{.*}}memcpy{{.*}} %[[RETVAL]]{{.*}} %[[COERCE]]
// CHECK: %[[COERCEDIVE1:.*]] = getelementptr{{.*}} %[[RETVAL]]
// CHECK: %[[TMP:.*]] = load{{.*}} %[[COERCEDIVE1]]
// CHECK: %[[COERCEVALPI:.*]] = ptrtoint{{.*}} %[[TMP]]
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index a7fce4f..8c2f497 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1609,7 +1609,7 @@ Expected<Value *> BitcodeReader::materializeValue(unsigned StartValID,
if (!Disc)
return error("ptrauth disc operand must be ConstantInt");
- auto *DeactivationSymbol =
+ Constant *DeactivationSymbol =
ConstOps.size() > 4 ? ConstOps[4]
: ConstantPointerNull::get(cast<PointerType>(
ConstOps[3]->getType()));