Skip to content

Commit 29d0a84

Browse files
authored
[clang][CGOpenMPRuntimeGPU] Avoid llvm::Type::getPointerTo() (NFC) (#110357)
`llvm::Type::getPointerTo()` is to be removed soon.
1 parent 6b62e04 commit 29d0a84

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,9 +1073,8 @@ void CGOpenMPRuntimeGPU::emitGenericVarsProlog(CodeGenFunction &CGF,
10731073
CGM.getContext().getTargetInfo().getNewAlign() / 8));
10741074

10751075
// Cast the void pointer and get the address of the globalized variable.
1076-
llvm::PointerType *VarPtrTy = CGF.ConvertTypeForMem(VarTy)->getPointerTo();
10771076
llvm::Value *CastedVoidPtr = Bld.CreatePointerBitCastOrAddrSpaceCast(
1078-
VoidPtr, VarPtrTy, VD->getName() + "_on_stack");
1077+
VoidPtr, Bld.getPtrTy(0), VD->getName() + "_on_stack");
10791078
LValue VarAddr =
10801079
CGF.MakeNaturalAlignPointeeRawAddrLValue(CastedVoidPtr, VarTy);
10811080
Rec.second.PrivateAddr = VarAddr.getAddress();
@@ -1930,7 +1929,7 @@ llvm::Function *CGOpenMPRuntimeGPU::createParallelDataSharingWrapper(
19301929
if (isOpenMPLoopBoundSharingDirective(D.getDirectiveKind())) {
19311930
Address Src = Bld.CreateConstInBoundsGEP(SharedArgListAddress, Idx);
19321931
Address TypedAddress = Bld.CreatePointerBitCastOrAddrSpaceCast(
1933-
Src, CGF.SizeTy->getPointerTo(), CGF.SizeTy);
1932+
Src, Bld.getPtrTy(0), CGF.SizeTy);
19341933
llvm::Value *LB = CGF.EmitLoadOfScalar(
19351934
TypedAddress,
19361935
/*Volatile=*/false,
@@ -1939,8 +1938,8 @@ llvm::Function *CGOpenMPRuntimeGPU::createParallelDataSharingWrapper(
19391938
Args.emplace_back(LB);
19401939
++Idx;
19411940
Src = Bld.CreateConstInBoundsGEP(SharedArgListAddress, Idx);
1942-
TypedAddress = Bld.CreatePointerBitCastOrAddrSpaceCast(
1943-
Src, CGF.SizeTy->getPointerTo(), CGF.SizeTy);
1941+
TypedAddress = Bld.CreatePointerBitCastOrAddrSpaceCast(Src, Bld.getPtrTy(0),
1942+
CGF.SizeTy);
19441943
llvm::Value *UB = CGF.EmitLoadOfScalar(
19451944
TypedAddress,
19461945
/*Volatile=*/false,
@@ -2079,7 +2078,7 @@ Address CGOpenMPRuntimeGPU::getAddressOfLocalVariable(CodeGenFunction &CGF,
20792078
GV->setAlignment(Align.getAsAlign());
20802079
return Address(
20812080
CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
2082-
GV, VarTy->getPointerTo(CGM.getContext().getTargetAddressSpace(
2081+
GV, CGF.Builder.getPtrTy(CGM.getContext().getTargetAddressSpace(
20832082
VD->getType().getAddressSpace()))),
20842083
VarTy, Align);
20852084
}

0 commit comments

Comments
 (0)