@@ -937,8 +937,7 @@ static LValue loadToBegin(CodeGenFunction &CGF, QualType BaseTy, QualType ElTy,
937
937
}
938
938
939
939
static Address castToBase(CodeGenFunction &CGF, QualType BaseTy, QualType ElTy,
940
- llvm::Type *BaseLVType, CharUnits BaseLVAlignment,
941
- llvm::Value *Addr) {
940
+ Address OriginalBaseAddress, llvm::Value *Addr) {
942
941
Address Tmp = Address::invalid();
943
942
Address TopTmp = Address::invalid();
944
943
Address MostTopTmp = Address::invalid();
@@ -953,15 +952,17 @@ static Address castToBase(CodeGenFunction &CGF, QualType BaseTy, QualType ElTy,
953
952
TopTmp = Tmp;
954
953
BaseTy = BaseTy->getPointeeType();
955
954
}
956
- llvm::Type *Ty = BaseLVType;
957
- if (Tmp.isValid())
958
- Ty = Tmp.getElementType();
959
- Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(Addr, Ty);
955
+
960
956
if (Tmp.isValid()) {
957
+ Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
958
+ Addr, Tmp.getElementType());
961
959
CGF.Builder.CreateStore(Addr, Tmp);
962
960
return MostTopTmp;
963
961
}
964
- return Address::deprecated(Addr, BaseLVAlignment);
962
+
963
+ Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
964
+ Addr, OriginalBaseAddress.getType());
965
+ return OriginalBaseAddress.withPointer(Addr);
965
966
}
966
967
967
968
static const VarDecl *getBaseDecl(const Expr *Ref, const DeclRefExpr *&DE) {
@@ -1004,8 +1005,7 @@ Address ReductionCodeGen::adjustPrivateAddress(CodeGenFunction &CGF, unsigned N,
1004
1005
SharedAddr.getElementType(), PrivatePointer, Adjustment);
1005
1006
return castToBase(CGF, OrigVD->getType(),
1006
1007
SharedAddresses[N].first.getType(),
1007
- OriginalBaseLValue.getAddress(CGF).getType(),
1008
- OriginalBaseLValue.getAlignment(), Ptr);
1008
+ OriginalBaseLValue.getAddress(CGF), Ptr);
1009
1009
}
1010
1010
BaseDecls.emplace_back(
1011
1011
cast<VarDecl>(cast<DeclRefExpr>(ClausesData[N].Ref)->getDecl()));
@@ -4046,12 +4046,12 @@ emitTaskDupFunction(CodeGenModule &CGM, SourceLocation Loc,
4046
4046
KmpTaskTWithPrivatesPtrQTy->castAs<PointerType>());
4047
4047
LValue Base = CGF.EmitLValueForField(
4048
4048
TDBase, *KmpTaskTWithPrivatesQTyRD->field_begin());
4049
- KmpTaskSharedsPtr = Address::deprecated (
4049
+ KmpTaskSharedsPtr = Address(
4050
4050
CGF.EmitLoadOfScalar(CGF.EmitLValueForField(
4051
4051
Base, *std::next(KmpTaskTQTyRD->field_begin(),
4052
4052
KmpTaskTShareds)),
4053
4053
Loc),
4054
- CGM.getNaturalTypeAlignment(SharedsTy));
4054
+ CGF.Int8Ty, CGM.getNaturalTypeAlignment(SharedsTy));
4055
4055
}
4056
4056
emitPrivatesInit(CGF, D, KmpTaskSharedsPtr, TDBase, KmpTaskTWithPrivatesQTyRD,
4057
4057
SharedsTy, SharedsPtrTy, Data, Privates, /*ForDup=*/true);
@@ -4531,13 +4531,13 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFunction &CGF, SourceLocation Loc,
4531
4531
// Copy shareds if there are any.
4532
4532
Address KmpTaskSharedsPtr = Address::invalid();
4533
4533
if (!SharedsTy->getAsStructureType()->getDecl()->field_empty()) {
4534
- KmpTaskSharedsPtr = Address::deprecated (
4534
+ KmpTaskSharedsPtr = Address(
4535
4535
CGF.EmitLoadOfScalar(
4536
4536
CGF.EmitLValueForField(
4537
4537
TDBase,
4538
4538
*std::next(KmpTaskTQTyRD->field_begin(), KmpTaskTShareds)),
4539
4539
Loc),
4540
- CGM.getNaturalTypeAlignment(SharedsTy));
4540
+ CGF.Int8Ty, CGM.getNaturalTypeAlignment(SharedsTy));
4541
4541
LValue Dest = CGF.MakeAddrLValue(KmpTaskSharedsPtr, SharedsTy);
4542
4542
LValue Src = CGF.MakeAddrLValue(Shareds, SharedsTy);
4543
4543
CGF.EmitAggregateCopy(Dest, Src, SharedsTy, AggValueSlot::DoesNotOverlap);
@@ -7847,8 +7847,9 @@ class MappableExprsHandler {
7847
7847
BP = CGF.EmitOMPSharedLValue(AssocExpr).getAddress(CGF);
7848
7848
} else if (OAShE &&
7849
7849
isa<CXXThisExpr>(OAShE->getBase()->IgnoreParenCasts())) {
7850
- BP = Address::deprecated (
7850
+ BP = Address(
7851
7851
CGF.EmitScalarExpr(OAShE->getBase()),
7852
+ CGF.ConvertTypeForMem(OAShE->getBase()->getType()->getPointeeType()),
7852
7853
CGF.getContext().getTypeAlignInChars(OAShE->getBase()->getType()));
7853
7854
} else {
7854
7855
// The base is the reference to the variable.
@@ -8019,9 +8020,11 @@ class MappableExprsHandler {
8019
8020
};
8020
8021
if (OAShE) {
8021
8022
LowestElem = LB =
8022
- Address::deprecated(CGF.EmitScalarExpr(OAShE->getBase()),
8023
- CGF.getContext().getTypeAlignInChars(
8024
- OAShE->getBase()->getType()));
8023
+ Address(CGF.EmitScalarExpr(OAShE->getBase()),
8024
+ CGF.ConvertTypeForMem(
8025
+ OAShE->getBase()->getType()->getPointeeType()),
8026
+ CGF.getContext().getTypeAlignInChars(
8027
+ OAShE->getBase()->getType()));
8025
8028
} else if (IsMemberReference) {
8026
8029
const auto *ME = cast<MemberExpr>(I->getAssociatedExpression());
8027
8030
LValue BaseLVal = EmitMemberExprBase(CGF, ME);
0 commit comments