Skip to content

Commit 27f6cee

Browse files
committed
Revert "[CodeGen] Avoid deprecated Address ctor in EmitLoadOfPointer()"
This reverts commit 767ec88. This results in a some incorrect alignments which are not covered by existing tests.
1 parent 09c0685 commit 27f6cee

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2547,10 +2547,10 @@ Address CodeGenFunction::EmitLoadOfPointer(Address Ptr,
25472547
LValueBaseInfo *BaseInfo,
25482548
TBAAAccessInfo *TBAAInfo) {
25492549
llvm::Value *Addr = Builder.CreateLoad(Ptr);
2550-
return Address(Addr, ConvertTypeForMem(PtrTy->getPointeeType()),
2551-
CGM.getNaturalTypeAlignment(PtrTy->getPointeeType(), BaseInfo,
2552-
TBAAInfo,
2553-
/*forPointeeType=*/true));
2550+
return Address::deprecated(
2551+
Addr,
2552+
CGM.getNaturalTypeAlignment(PtrTy->getPointeeType(), BaseInfo, TBAAInfo,
2553+
/*forPointeeType=*/true));
25542554
}
25552555

25562556
LValue CodeGenFunction::EmitLoadOfPointerLValue(Address PtrAddr,

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4652,7 +4652,8 @@ CGOpenMPRuntime::getDepobjElements(CodeGenFunction &CGF, LValue DepobjLVal,
46524652
RecordDecl *KmpDependInfoRD =
46534653
cast<RecordDecl>(KmpDependInfoTy->getAsTagDecl());
46544654
LValue Base = CGF.EmitLoadOfPointerLValue(
4655-
DepobjLVal.getAddress(CGF), C.VoidPtrTy.castAs<PointerType>());
4655+
DepobjLVal.getAddress(CGF),
4656+
C.getPointerType(C.VoidPtrTy).castAs<PointerType>());
46564657
QualType KmpDependInfoPtrTy = C.getPointerType(KmpDependInfoTy);
46574658
Address Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
46584659
Base.getAddress(CGF), CGF.ConvertTypeForMem(KmpDependInfoPtrTy),
@@ -4749,7 +4750,8 @@ emitDepobjElementsSizes(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
47494750
for (const Expr *E : Data.DepExprs) {
47504751
LValue DepobjLVal = CGF.EmitLValue(E->IgnoreParenImpCasts());
47514752
LValue Base = CGF.EmitLoadOfPointerLValue(
4752-
DepobjLVal.getAddress(CGF), C.VoidPtrTy.castAs<PointerType>());
4753+
DepobjLVal.getAddress(CGF),
4754+
C.getPointerType(C.VoidPtrTy).castAs<PointerType>());
47534755
Address Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
47544756
Base.getAddress(CGF), KmpDependInfoPtrT,
47554757
CGF.ConvertTypeForMem(KmpDependInfoTy));
@@ -4806,7 +4808,8 @@ static void emitDepobjElements(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
48064808
const Expr *E = Data.DepExprs[I];
48074809
LValue DepobjLVal = CGF.EmitLValue(E->IgnoreParenImpCasts());
48084810
LValue Base = CGF.EmitLoadOfPointerLValue(
4809-
DepobjLVal.getAddress(CGF), C.VoidPtrTy.castAs<PointerType>());
4811+
DepobjLVal.getAddress(CGF),
4812+
C.getPointerType(C.VoidPtrTy).castAs<PointerType>());
48104813
Address Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
48114814
Base.getAddress(CGF), KmpDependInfoPtrT,
48124815
CGF.ConvertTypeForMem(KmpDependInfoTy));
@@ -5055,7 +5058,8 @@ void CGOpenMPRuntime::emitDestroyClause(CodeGenFunction &CGF, LValue DepobjLVal,
50555058
QualType FlagsTy;
50565059
getDependTypes(C, KmpDependInfoTy, FlagsTy);
50575060
LValue Base = CGF.EmitLoadOfPointerLValue(
5058-
DepobjLVal.getAddress(CGF), C.VoidPtrTy.castAs<PointerType>());
5061+
DepobjLVal.getAddress(CGF),
5062+
C.getPointerType(C.VoidPtrTy).castAs<PointerType>());
50595063
QualType KmpDependInfoPtrTy = C.getPointerType(KmpDependInfoTy);
50605064
Address Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
50615065
Base.getAddress(CGF), CGF.ConvertTypeForMem(KmpDependInfoPtrTy),
@@ -6037,7 +6041,8 @@ static llvm::Value *emitReduceFiniFunction(CodeGenModule &CGM,
60376041
CodeGenFunction CGF(CGM);
60386042
CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, FnInfo, Args, Loc, Loc);
60396043
Address PrivateAddr = CGF.EmitLoadOfPointer(
6040-
CGF.GetAddrOfLocalVar(&Param), C.VoidPtrTy.castAs<PointerType>());
6044+
CGF.GetAddrOfLocalVar(&Param),
6045+
C.getPointerType(C.VoidPtrTy).castAs<PointerType>());
60416046
llvm::Value *Size = nullptr;
60426047
// If the size of the reduction item is non-constant, load it from global
60436048
// threadprivate variable.

clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3558,7 +3558,8 @@ llvm::Function *CGOpenMPRuntimeGPU::createParallelDataSharingWrapper(
35583558
isOpenMPLoopBoundSharingDirective(D.getDirectiveKind())) {
35593559
SharedArgListAddress = CGF.EmitLoadOfPointer(
35603560
GlobalArgs, CGF.getContext()
3561-
.getPointerType(CGF.getContext().VoidPtrTy)
3561+
.getPointerType(CGF.getContext().getPointerType(
3562+
CGF.getContext().VoidPtrTy))
35623563
.castAs<PointerType>());
35633564
}
35643565
unsigned Idx = 0;

clang/lib/CodeGen/CodeGenFunction.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,9 +2527,6 @@ class CodeGenFunction : public CodeGenTypeCache {
25272527
return EmitLoadOfReferenceLValue(RefLVal);
25282528
}
25292529

2530-
/// Load a pointer with type \p PtrTy stored at address \p Ptr.
2531-
/// Note that \p PtrTy is the type of the loaded pointer, not the addresses
2532-
/// it is loaded from.
25332530
Address EmitLoadOfPointer(Address Ptr, const PointerType *PtrTy,
25342531
LValueBaseInfo *BaseInfo = nullptr,
25352532
TBAAAccessInfo *TBAAInfo = nullptr);

0 commit comments

Comments
 (0)