forked from OSchip/llvm-project
[NFC][Clang][OpaquePtr] Remove the call to Address::deprecated in
CreatePointerBitCastOrAddrSpaceCast Differential Revision: https://reviews.llvm.org/D120757
This commit is contained in:
parent
db48f7b2f7
commit
d112cc2756
|
@ -304,7 +304,8 @@ Address AtomicInfo::CreateTempAlloca() const {
|
|||
// Cast to pointer to value type for bitfields.
|
||||
if (LVal.isBitField())
|
||||
return CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
TempAlloca, getAtomicAddress().getType());
|
||||
TempAlloca, getAtomicAddress().getType(),
|
||||
getAtomicAddress().getElementType());
|
||||
return TempAlloca;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,10 +171,11 @@ public:
|
|||
|
||||
using CGBuilderBaseTy::CreatePointerBitCastOrAddrSpaceCast;
|
||||
Address CreatePointerBitCastOrAddrSpaceCast(Address Addr, llvm::Type *Ty,
|
||||
llvm::Type *ElementTy,
|
||||
const llvm::Twine &Name = "") {
|
||||
llvm::Value *Ptr =
|
||||
CreatePointerBitCastOrAddrSpaceCast(Addr.getPointer(), Ty, Name);
|
||||
return Address::deprecated(Ptr, Addr.getAlignment());
|
||||
return Address(Ptr, ElementTy, Addr.getAlignment());
|
||||
}
|
||||
|
||||
/// Given
|
||||
|
|
|
@ -2707,7 +2707,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
|
|||
auto *PTy = llvm::PointerType::get(
|
||||
VarTy, getContext().getTargetAddressSpace(VD->getType()));
|
||||
if (PTy != Addr.getType())
|
||||
Addr = Builder.CreatePointerBitCastOrAddrSpaceCast(Addr, PTy);
|
||||
Addr = Builder.CreatePointerBitCastOrAddrSpaceCast(Addr, PTy, VarTy);
|
||||
} else {
|
||||
// Should we be using the alignment of the constant pointer we emitted?
|
||||
CharUnits Alignment =
|
||||
|
|
|
@ -2502,9 +2502,8 @@ void CGOpenMPRuntime::emitSingleRegion(CodeGenFunction &CGF,
|
|||
CGM, CGF.ConvertTypeForMem(CopyprivateArrayTy)->getPointerTo(),
|
||||
CopyprivateVars, SrcExprs, DstExprs, AssignmentOps, Loc);
|
||||
llvm::Value *BufSize = CGF.getTypeSize(CopyprivateArrayTy);
|
||||
Address CL =
|
||||
CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(CopyprivateList,
|
||||
CGF.VoidPtrTy);
|
||||
Address CL = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
CopyprivateList, CGF.VoidPtrTy, CGF.Int8Ty);
|
||||
llvm::Value *DidItVal = CGF.Builder.CreateLoad(DidIt);
|
||||
llvm::Value *Args[] = {
|
||||
emitUpdateLocation(CGF, Loc), // ident_t *<loc>
|
||||
|
@ -3647,12 +3646,12 @@ emitProxyTaskFunction(CodeGenModule &CGM, SourceLocation Loc,
|
|||
PrivatesParam = llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
|
||||
}
|
||||
|
||||
llvm::Value *CommonArgs[] = {GtidParam, PartidParam, PrivatesParam,
|
||||
TaskPrivatesMap,
|
||||
CGF.Builder
|
||||
.CreatePointerBitCastOrAddrSpaceCast(
|
||||
TDBase.getAddress(CGF), CGF.VoidPtrTy)
|
||||
.getPointer()};
|
||||
llvm::Value *CommonArgs[] = {
|
||||
GtidParam, PartidParam, PrivatesParam, TaskPrivatesMap,
|
||||
CGF.Builder
|
||||
.CreatePointerBitCastOrAddrSpaceCast(TDBase.getAddress(CGF),
|
||||
CGF.VoidPtrTy, CGF.Int8Ty)
|
||||
.getPointer()};
|
||||
SmallVector<llvm::Value *, 16> CallArgs(std::begin(CommonArgs),
|
||||
std::end(CommonArgs));
|
||||
if (isOpenMPTaskLoopDirective(Kind)) {
|
||||
|
@ -3872,7 +3871,8 @@ static void emitPrivatesInit(CodeGenFunction &CGF,
|
|||
(IsTargetTask && KmpTaskSharedsPtr.isValid())) {
|
||||
SrcBase = CGF.MakeAddrLValue(
|
||||
CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
KmpTaskSharedsPtr, CGF.ConvertTypeForMem(SharedsPtrTy)),
|
||||
KmpTaskSharedsPtr, CGF.ConvertTypeForMem(SharedsPtrTy),
|
||||
CGF.ConvertTypeForMem(SharedsTy)),
|
||||
SharedsTy);
|
||||
}
|
||||
FI = cast<RecordDecl>(FI->getType()->getAsTagDecl())->field_begin();
|
||||
|
@ -4664,7 +4664,8 @@ CGOpenMPRuntime::getDepobjElements(CodeGenFunction &CGF, LValue DepobjLVal,
|
|||
C.getPointerType(C.VoidPtrTy).castAs<PointerType>());
|
||||
QualType KmpDependInfoPtrTy = C.getPointerType(KmpDependInfoTy);
|
||||
Address Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
Base.getAddress(CGF), CGF.ConvertTypeForMem(KmpDependInfoPtrTy));
|
||||
Base.getAddress(CGF), CGF.ConvertTypeForMem(KmpDependInfoPtrTy),
|
||||
CGF.ConvertTypeForMem(KmpDependInfoTy));
|
||||
Base = CGF.MakeAddrLValue(Addr, KmpDependInfoTy, Base.getBaseInfo(),
|
||||
Base.getTBAAInfo());
|
||||
Address DepObjAddr = CGF.Builder.CreateGEP(
|
||||
|
@ -4760,7 +4761,8 @@ emitDepobjElementsSizes(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
|
|||
DepobjLVal.getAddress(CGF),
|
||||
C.getPointerType(C.VoidPtrTy).castAs<PointerType>());
|
||||
Address Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
Base.getAddress(CGF), KmpDependInfoPtrT);
|
||||
Base.getAddress(CGF), KmpDependInfoPtrT,
|
||||
CGF.ConvertTypeForMem(KmpDependInfoTy));
|
||||
Base = CGF.MakeAddrLValue(Addr, KmpDependInfoTy, Base.getBaseInfo(),
|
||||
Base.getTBAAInfo());
|
||||
Address DepObjAddr = CGF.Builder.CreateGEP(
|
||||
|
@ -4817,7 +4819,8 @@ static void emitDepobjElements(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
|
|||
DepobjLVal.getAddress(CGF),
|
||||
C.getPointerType(C.VoidPtrTy).castAs<PointerType>());
|
||||
Address Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
Base.getAddress(CGF), KmpDependInfoPtrT);
|
||||
Base.getAddress(CGF), KmpDependInfoPtrT,
|
||||
CGF.ConvertTypeForMem(KmpDependInfoTy));
|
||||
Base = CGF.MakeAddrLValue(Addr, KmpDependInfoTy, Base.getBaseInfo(),
|
||||
Base.getTBAAInfo());
|
||||
|
||||
|
@ -4968,7 +4971,7 @@ std::pair<llvm::Value *, Address> CGOpenMPRuntime::emitDependClause(
|
|||
}
|
||||
}
|
||||
DependenciesArray = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
DependenciesArray, CGF.VoidPtrTy);
|
||||
DependenciesArray, CGF.VoidPtrTy, CGF.Int8Ty);
|
||||
return std::make_pair(NumOfElements, DependenciesArray);
|
||||
}
|
||||
|
||||
|
@ -5051,7 +5054,8 @@ Address CGOpenMPRuntime::emitDepobjDependClause(
|
|||
}
|
||||
emitDependData(CGF, KmpDependInfoTy, Pos, Dependencies, DependenciesArray);
|
||||
DependenciesArray = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
CGF.Builder.CreateConstGEP(DependenciesArray, 1), CGF.VoidPtrTy);
|
||||
CGF.Builder.CreateConstGEP(DependenciesArray, 1), CGF.VoidPtrTy,
|
||||
CGF.Int8Ty);
|
||||
return DependenciesArray;
|
||||
}
|
||||
|
||||
|
@ -5065,7 +5069,8 @@ void CGOpenMPRuntime::emitDestroyClause(CodeGenFunction &CGF, LValue DepobjLVal,
|
|||
C.getPointerType(C.VoidPtrTy).castAs<PointerType>());
|
||||
QualType KmpDependInfoPtrTy = C.getPointerType(KmpDependInfoTy);
|
||||
Address Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
Base.getAddress(CGF), CGF.ConvertTypeForMem(KmpDependInfoPtrTy));
|
||||
Base.getAddress(CGF), CGF.ConvertTypeForMem(KmpDependInfoPtrTy),
|
||||
CGF.ConvertTypeForMem(KmpDependInfoTy));
|
||||
llvm::Value *DepObjAddr = CGF.Builder.CreateGEP(
|
||||
Addr.getElementType(), Addr.getPointer(),
|
||||
llvm::ConstantInt::get(CGF.IntPtrTy, -1, /*isSigned=*/true));
|
||||
|
@ -6489,7 +6494,7 @@ void CGOpenMPRuntime::emitUsesAllocatorsInit(CodeGenFunction &CGF,
|
|||
.getLimitedValue());
|
||||
LValue AllocatorTraitsLVal = CGF.EmitLValue(AllocatorTraits);
|
||||
Address Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
AllocatorTraitsLVal.getAddress(CGF), CGF.VoidPtrPtrTy);
|
||||
AllocatorTraitsLVal.getAddress(CGF), CGF.VoidPtrPtrTy, CGF.VoidPtrTy);
|
||||
AllocatorTraitsLVal = CGF.MakeAddrLValue(Addr, CGF.getContext().VoidPtrTy,
|
||||
AllocatorTraitsLVal.getBaseInfo(),
|
||||
AllocatorTraitsLVal.getTBAAInfo());
|
||||
|
@ -8107,8 +8112,8 @@ private:
|
|||
CharUnits TypeSize = CGF.getContext().getTypeSizeInChars(
|
||||
I->getAssociatedExpression()->getType());
|
||||
Address HB = CGF.Builder.CreateConstGEP(
|
||||
CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(LowestElem,
|
||||
CGF.VoidPtrTy),
|
||||
CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
LowestElem, CGF.VoidPtrTy, CGF.Int8Ty),
|
||||
TypeSize.getQuantity() - 1);
|
||||
PartialStruct.HighestElem = {
|
||||
std::numeric_limits<decltype(
|
||||
|
@ -9528,7 +9533,7 @@ static void emitNonContiguousDescriptor(
|
|||
}
|
||||
// args[I] = &dims
|
||||
Address DAddr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
DimsAddr, CGM.Int8PtrTy);
|
||||
DimsAddr, CGM.Int8PtrTy, CGM.Int8Ty);
|
||||
llvm::Value *P = CGF.Builder.CreateConstInBoundsGEP2_32(
|
||||
llvm::ArrayType::get(CGM.VoidPtrTy, Info.NumberOfPtrs),
|
||||
Info.PointersArray, 0, I);
|
||||
|
@ -12826,7 +12831,8 @@ void CGOpenMPRuntime::checkAndEmitLastprivateConditional(CodeGenFunction &CGF,
|
|||
LValue PrivLVal = CGF.EmitLValue(FoundE);
|
||||
Address StructAddr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
PrivLVal.getAddress(CGF),
|
||||
CGF.ConvertTypeForMem(CGF.getContext().getPointerType(StructTy)));
|
||||
CGF.ConvertTypeForMem(CGF.getContext().getPointerType(StructTy)),
|
||||
CGF.ConvertTypeForMem(StructTy));
|
||||
LValue BaseLVal =
|
||||
CGF.MakeAddrLValue(StructAddr, StructTy, AlignmentSource::Decl);
|
||||
LValue FiredLVal = CGF.EmitLValueForField(BaseLVal, FiredDecl);
|
||||
|
|
|
@ -1716,7 +1716,8 @@ static llvm::Value *castValueToType(CodeGenFunction &CGF, llvm::Value *Val,
|
|||
CastTy->hasSignedIntegerRepresentation());
|
||||
Address CastItem = CGF.CreateMemTemp(CastTy);
|
||||
Address ValCastItem = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
CastItem, Val->getType()->getPointerTo(CastItem.getAddressSpace()));
|
||||
CastItem, Val->getType()->getPointerTo(CastItem.getAddressSpace()),
|
||||
Val->getType());
|
||||
CGF.EmitStoreOfScalar(Val, ValCastItem, /*Volatile=*/false, ValTy,
|
||||
LValueBaseInfo(AlignmentSource::Type),
|
||||
TBAAAccessInfo());
|
||||
|
@ -1779,7 +1780,7 @@ static void shuffleAndStore(CodeGenFunction &CGF, Address SrcAddr,
|
|||
Address ElemPtr = DestAddr;
|
||||
Address Ptr = SrcAddr;
|
||||
Address PtrEnd = Bld.CreatePointerBitCastOrAddrSpaceCast(
|
||||
Bld.CreateConstGEP(SrcAddr, 1), CGF.VoidPtrTy);
|
||||
Bld.CreateConstGEP(SrcAddr, 1), CGF.VoidPtrTy, CGF.Int8Ty);
|
||||
for (int IntSize = 8; IntSize >= 1; IntSize /= 2) {
|
||||
if (Size < CharUnits::fromQuantity(IntSize))
|
||||
continue;
|
||||
|
@ -1787,9 +1788,10 @@ static void shuffleAndStore(CodeGenFunction &CGF, Address SrcAddr,
|
|||
CGF.getContext().toBits(CharUnits::fromQuantity(IntSize)),
|
||||
/*Signed=*/1);
|
||||
llvm::Type *IntTy = CGF.ConvertTypeForMem(IntType);
|
||||
Ptr = Bld.CreatePointerBitCastOrAddrSpaceCast(Ptr, IntTy->getPointerTo());
|
||||
ElemPtr =
|
||||
Bld.CreatePointerBitCastOrAddrSpaceCast(ElemPtr, IntTy->getPointerTo());
|
||||
Ptr = Bld.CreatePointerBitCastOrAddrSpaceCast(Ptr, IntTy->getPointerTo(),
|
||||
IntTy);
|
||||
ElemPtr = Bld.CreatePointerBitCastOrAddrSpaceCast(
|
||||
ElemPtr, IntTy->getPointerTo(), IntTy);
|
||||
if (Size.getQuantity() / IntSize > 1) {
|
||||
llvm::BasicBlock *PreCondBB = CGF.createBasicBlock(".shuffle.pre_cond");
|
||||
llvm::BasicBlock *ThenBB = CGF.createBasicBlock(".shuffle.then");
|
||||
|
@ -3545,7 +3547,7 @@ llvm::Function *CGOpenMPRuntimeGPU::createParallelDataSharingWrapper(
|
|||
if (isOpenMPLoopBoundSharingDirective(D.getDirectiveKind())) {
|
||||
Address Src = Bld.CreateConstInBoundsGEP(SharedArgListAddress, Idx);
|
||||
Address TypedAddress = Bld.CreatePointerBitCastOrAddrSpaceCast(
|
||||
Src, CGF.SizeTy->getPointerTo());
|
||||
Src, CGF.SizeTy->getPointerTo(), CGF.SizeTy);
|
||||
llvm::Value *LB = CGF.EmitLoadOfScalar(
|
||||
TypedAddress,
|
||||
/*Volatile=*/false,
|
||||
|
@ -3555,7 +3557,7 @@ llvm::Function *CGOpenMPRuntimeGPU::createParallelDataSharingWrapper(
|
|||
++Idx;
|
||||
Src = Bld.CreateConstInBoundsGEP(SharedArgListAddress, Idx);
|
||||
TypedAddress = Bld.CreatePointerBitCastOrAddrSpaceCast(
|
||||
Src, CGF.SizeTy->getPointerTo());
|
||||
Src, CGF.SizeTy->getPointerTo(), CGF.SizeTy);
|
||||
llvm::Value *UB = CGF.EmitLoadOfScalar(
|
||||
TypedAddress,
|
||||
/*Volatile=*/false,
|
||||
|
@ -3570,7 +3572,8 @@ llvm::Function *CGOpenMPRuntimeGPU::createParallelDataSharingWrapper(
|
|||
QualType ElemTy = CurField->getType();
|
||||
Address Src = Bld.CreateConstInBoundsGEP(SharedArgListAddress, I + Idx);
|
||||
Address TypedAddress = Bld.CreatePointerBitCastOrAddrSpaceCast(
|
||||
Src, CGF.ConvertTypeForMem(CGFContext.getPointerType(ElemTy)));
|
||||
Src, CGF.ConvertTypeForMem(CGFContext.getPointerType(ElemTy)),
|
||||
CGF.ConvertTypeForMem(ElemTy));
|
||||
llvm::Value *Arg = CGF.EmitLoadOfScalar(TypedAddress,
|
||||
/*Volatile=*/false,
|
||||
CGFContext.getPointerType(ElemTy),
|
||||
|
|
|
@ -670,7 +670,8 @@ CodeGenFunction::GenerateOpenMPCapturedStmtFunction(const CapturedStmt &S,
|
|||
LV.setAddress(WrapperCGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
LV.getAddress(WrapperCGF),
|
||||
PI->getType()->getPointerTo(
|
||||
LV.getAddress(WrapperCGF).getAddressSpace())));
|
||||
LV.getAddress(WrapperCGF).getAddressSpace()),
|
||||
PI->getType()));
|
||||
CallArg = WrapperCGF.EmitLoadOfScalar(LV, S.getBeginLoc());
|
||||
} else {
|
||||
auto EI = VLASizes.find(Arg);
|
||||
|
@ -7000,10 +7001,11 @@ void CodeGenFunction::EmitOMPUseDeviceAddrClause(
|
|||
EmitLoadOfPointer(PrivAddr, getContext()
|
||||
.getPointerType(OrigVD->getType())
|
||||
->castAs<PointerType>());
|
||||
llvm::Type *RealTy =
|
||||
ConvertTypeForMem(OrigVD->getType().getNonReferenceType())
|
||||
->getPointerTo();
|
||||
PrivAddr = Builder.CreatePointerBitCastOrAddrSpaceCast(PrivAddr, RealTy);
|
||||
llvm::Type *RealElTy =
|
||||
ConvertTypeForMem(OrigVD->getType().getNonReferenceType());
|
||||
llvm::Type *RealTy = RealElTy->getPointerTo();
|
||||
PrivAddr =
|
||||
Builder.CreatePointerBitCastOrAddrSpaceCast(PrivAddr, RealTy, RealElTy);
|
||||
|
||||
(void)PrivateScope.addPrivate(OrigVD, [PrivAddr]() { return PrivAddr; });
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue