diff options
-rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 10 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/trivial_abi.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 2 |
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())); |