Skip to content

Commit e53b28c

Browse files
committed
[llvm] Drop some bitcasts and references related to typed pointers
Differential Revision: https://reviews.llvm.org/D157551
1 parent d03f417 commit e53b28c

28 files changed

+91
-168
lines changed

llvm/lib/CodeGen/AtomicExpandPass.cpp

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,6 @@ static void createCmpXchgInstFun(IRBuilderBase &Builder, Value *Addr,
547547
bool NeedBitcast = OrigTy->isFloatingPointTy();
548548
if (NeedBitcast) {
549549
IntegerType *IntTy = Builder.getIntNTy(OrigTy->getPrimitiveSizeInBits());
550-
unsigned AS = Addr->getType()->getPointerAddressSpace();
551-
Addr = Builder.CreateBitCast(Addr, IntTy->getPointerTo(AS));
552550
NewVal = Builder.CreateBitCast(NewVal, IntTy);
553551
Loaded = Builder.CreateBitCast(Loaded, IntTy);
554552
}
@@ -721,7 +719,6 @@ static PartwordMaskValues createMaskInstrs(IRBuilderBase &Builder,
721719
assert(ValueSize < MinWordSize);
722720

723721
PointerType *PtrTy = cast<PointerType>(Addr->getType());
724-
Type *WordPtrType = PMV.WordType->getPointerTo(PtrTy->getAddressSpace());
725722
IntegerType *IntTy = DL.getIntPtrType(Ctx, PtrTy->getAddressSpace());
726723
Value *PtrLSB;
727724

@@ -755,10 +752,6 @@ static PartwordMaskValues createMaskInstrs(IRBuilderBase &Builder,
755752

756753
PMV.Inv_Mask = Builder.CreateNot(PMV.Mask, "Inv_Mask");
757754

758-
// Cast for typed pointers.
759-
PMV.AlignedAddr =
760-
Builder.CreateBitCast(PMV.AlignedAddr, WordPtrType, "AlignedAddr");
761-
762755
return PMV;
763756
}
764757

@@ -1841,11 +1834,8 @@ bool AtomicExpand::expandAtomicOpToLibcall(
18411834
// variables.
18421835

18431836
AllocaInst *AllocaCASExpected = nullptr;
1844-
Value *AllocaCASExpected_i8 = nullptr;
18451837
AllocaInst *AllocaValue = nullptr;
1846-
Value *AllocaValue_i8 = nullptr;
18471838
AllocaInst *AllocaResult = nullptr;
1848-
Value *AllocaResult_i8 = nullptr;
18491839

18501840
Type *ResultTy;
18511841
SmallVector<Value *, 6> Args;
@@ -1862,23 +1852,17 @@ bool AtomicExpand::expandAtomicOpToLibcall(
18621852
// implementation and that addresses are convertable. For systems without
18631853
// that property, we'd need to extend this mechanism to support AS-specific
18641854
// families of atomic intrinsics.
1865-
auto PtrTypeAS = PointerOperand->getType()->getPointerAddressSpace();
1866-
Value *PtrVal =
1867-
Builder.CreateBitCast(PointerOperand, Type::getInt8PtrTy(Ctx, PtrTypeAS));
1868-
PtrVal = Builder.CreateAddrSpaceCast(PtrVal, Type::getInt8PtrTy(Ctx));
1855+
Value *PtrVal = PointerOperand;
1856+
PtrVal = Builder.CreateAddrSpaceCast(PtrVal, PointerType::getUnqual(Ctx));
18691857
Args.push_back(PtrVal);
18701858

18711859
// 'expected' argument, if present.
18721860
if (CASExpected) {
18731861
AllocaCASExpected = AllocaBuilder.CreateAlloca(CASExpected->getType());
18741862
AllocaCASExpected->setAlignment(AllocaAlignment);
1875-
unsigned AllocaAS = AllocaCASExpected->getType()->getPointerAddressSpace();
1876-
1877-
AllocaCASExpected_i8 = Builder.CreateBitCast(
1878-
AllocaCASExpected, Type::getInt8PtrTy(Ctx, AllocaAS));
1879-
Builder.CreateLifetimeStart(AllocaCASExpected_i8, SizeVal64);
1863+
Builder.CreateLifetimeStart(AllocaCASExpected, SizeVal64);
18801864
Builder.CreateAlignedStore(CASExpected, AllocaCASExpected, AllocaAlignment);
1881-
Args.push_back(AllocaCASExpected_i8);
1865+
Args.push_back(AllocaCASExpected);
18821866
}
18831867

18841868
// 'val' argument ('desired' for cas), if present.
@@ -1890,23 +1874,18 @@ bool AtomicExpand::expandAtomicOpToLibcall(
18901874
} else {
18911875
AllocaValue = AllocaBuilder.CreateAlloca(ValueOperand->getType());
18921876
AllocaValue->setAlignment(AllocaAlignment);
1893-
AllocaValue_i8 =
1894-
Builder.CreateBitCast(AllocaValue, Type::getInt8PtrTy(Ctx));
1895-
Builder.CreateLifetimeStart(AllocaValue_i8, SizeVal64);
1877+
Builder.CreateLifetimeStart(AllocaValue, SizeVal64);
18961878
Builder.CreateAlignedStore(ValueOperand, AllocaValue, AllocaAlignment);
1897-
Args.push_back(AllocaValue_i8);
1879+
Args.push_back(AllocaValue);
18981880
}
18991881
}
19001882

19011883
// 'ret' argument.
19021884
if (!CASExpected && HasResult && !UseSizedLibcall) {
19031885
AllocaResult = AllocaBuilder.CreateAlloca(I->getType());
19041886
AllocaResult->setAlignment(AllocaAlignment);
1905-
unsigned AllocaAS = AllocaResult->getType()->getPointerAddressSpace();
1906-
AllocaResult_i8 =
1907-
Builder.CreateBitCast(AllocaResult, Type::getInt8PtrTy(Ctx, AllocaAS));
1908-
Builder.CreateLifetimeStart(AllocaResult_i8, SizeVal64);
1909-
Args.push_back(AllocaResult_i8);
1887+
Builder.CreateLifetimeStart(AllocaResult, SizeVal64);
1888+
Args.push_back(AllocaResult);
19101889
}
19111890

19121891
// 'ordering' ('success_order' for cas) argument.
@@ -1938,7 +1917,7 @@ bool AtomicExpand::expandAtomicOpToLibcall(
19381917

19391918
// And then, extract the results...
19401919
if (ValueOperand && !UseSizedLibcall)
1941-
Builder.CreateLifetimeEnd(AllocaValue_i8, SizeVal64);
1920+
Builder.CreateLifetimeEnd(AllocaValue, SizeVal64);
19421921

19431922
if (CASExpected) {
19441923
// The final result from the CAS is {load of 'expected' alloca, bool result
@@ -1947,7 +1926,7 @@ bool AtomicExpand::expandAtomicOpToLibcall(
19471926
Value *V = PoisonValue::get(FinalResultTy);
19481927
Value *ExpectedOut = Builder.CreateAlignedLoad(
19491928
CASExpected->getType(), AllocaCASExpected, AllocaAlignment);
1950-
Builder.CreateLifetimeEnd(AllocaCASExpected_i8, SizeVal64);
1929+
Builder.CreateLifetimeEnd(AllocaCASExpected, SizeVal64);
19511930
V = Builder.CreateInsertValue(V, ExpectedOut, 0);
19521931
V = Builder.CreateInsertValue(V, Result, 1);
19531932
I->replaceAllUsesWith(V);
@@ -1958,7 +1937,7 @@ bool AtomicExpand::expandAtomicOpToLibcall(
19581937
else {
19591938
V = Builder.CreateAlignedLoad(I->getType(), AllocaResult,
19601939
AllocaAlignment);
1961-
Builder.CreateLifetimeEnd(AllocaResult_i8, SizeVal64);
1940+
Builder.CreateLifetimeEnd(AllocaResult, SizeVal64);
19621941
}
19631942
I->replaceAllUsesWith(V);
19641943
}

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9618,7 +9618,7 @@ SDValue TargetLowering::LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA,
96189618
// Access to address of TLS varialbe xyz is lowered to a function call:
96199619
// __emutls_get_address( address of global variable named "__emutls_v.xyz" )
96209620
EVT PtrVT = getPointerTy(DAG.getDataLayout());
9621-
PointerType *VoidPtrType = Type::getInt8PtrTy(*DAG.getContext());
9621+
PointerType *VoidPtrType = PointerType::get(*DAG.getContext(), 0);
96229622
SDLoc dl(GA);
96239623

96249624
ArgListTy Args;

llvm/lib/ExecutionEngine/ExecutionEngine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ int ExecutionEngine::runFunctionAsMain(Function *Fn,
430430
// Check main() type
431431
unsigned NumArgs = Fn->getFunctionType()->getNumParams();
432432
FunctionType *FTy = Fn->getFunctionType();
433-
Type* PPInt8Ty = Type::getInt8PtrTy(Fn->getContext())->getPointerTo();
433+
Type *PPInt8Ty = PointerType::get(Fn->getContext(), 0);
434434

435435
// Check the argument types.
436436
if (NumArgs > 3)

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,15 +1409,15 @@ GlobalVariable *llvm::UpgradeGlobalVariable(GlobalVariable *GV) {
14091409
LLVMContext &C = GV->getContext();
14101410
IRBuilder<> IRB(C);
14111411
auto EltTy = StructType::get(STy->getElementType(0), STy->getElementType(1),
1412-
IRB.getInt8PtrTy());
1412+
IRB.getPtrTy());
14131413
Constant *Init = GV->getInitializer();
14141414
unsigned N = Init->getNumOperands();
14151415
std::vector<Constant *> NewCtors(N);
14161416
for (unsigned i = 0; i != N; ++i) {
14171417
auto Ctor = cast<Constant>(Init->getOperand(i));
1418-
NewCtors[i] = ConstantStruct::get(
1419-
EltTy, Ctor->getAggregateElement(0u), Ctor->getAggregateElement(1),
1420-
Constant::getNullValue(IRB.getInt8PtrTy()));
1418+
NewCtors[i] = ConstantStruct::get(EltTy, Ctor->getAggregateElement(0u),
1419+
Ctor->getAggregateElement(1),
1420+
Constant::getNullValue(IRB.getPtrTy()));
14211421
}
14221422
Constant *NewInit = ConstantArray::get(ArrayType::get(EltTy, N), NewCtors);
14231423

@@ -4430,10 +4430,10 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
44304430
}
44314431

44324432
// Create a new call with an added null annotation attribute argument.
4433-
NewCall = Builder.CreateCall(
4434-
NewFn,
4435-
{CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2),
4436-
CI->getArgOperand(3), Constant::getNullValue(Builder.getInt8PtrTy())});
4433+
NewCall =
4434+
Builder.CreateCall(NewFn, {CI->getArgOperand(0), CI->getArgOperand(1),
4435+
CI->getArgOperand(2), CI->getArgOperand(3),
4436+
Constant::getNullValue(Builder.getPtrTy())});
44374437
NewCall->takeName(CI);
44384438
CI->replaceAllUsesWith(NewCall);
44394439
CI->eraseFromParent();
@@ -4446,10 +4446,10 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
44464446
return;
44474447
}
44484448
// Create a new call with an added null annotation attribute argument.
4449-
NewCall = Builder.CreateCall(
4450-
NewFn,
4451-
{CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2),
4452-
CI->getArgOperand(3), Constant::getNullValue(Builder.getInt8PtrTy())});
4449+
NewCall =
4450+
Builder.CreateCall(NewFn, {CI->getArgOperand(0), CI->getArgOperand(1),
4451+
CI->getArgOperand(2), CI->getArgOperand(3),
4452+
Constant::getNullValue(Builder.getPtrTy())});
44534453
NewCall->takeName(CI);
44544454
CI->replaceAllUsesWith(NewCall);
44554455
CI->eraseFromParent();

llvm/lib/IR/Instructions.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ static Instruction *createMalloc(Instruction *InsertBefore,
830830
// Create the call to Malloc.
831831
BasicBlock *BB = InsertBefore ? InsertBefore->getParent() : InsertAtEnd;
832832
Module *M = BB->getParent()->getParent();
833-
Type *BPTy = Type::getInt8PtrTy(BB->getContext());
833+
Type *BPTy = PointerType::getUnqual(BB->getContext());
834834
FunctionCallee MallocFunc = MallocF;
835835
if (!MallocFunc)
836836
// prototype malloc as "void *malloc(size_t)"
@@ -926,20 +926,14 @@ static Instruction *createFree(Value *Source,
926926
Module *M = BB->getParent()->getParent();
927927

928928
Type *VoidTy = Type::getVoidTy(M->getContext());
929-
Type *IntPtrTy = Type::getInt8PtrTy(M->getContext());
929+
Type *VoidPtrTy = PointerType::getUnqual(M->getContext());
930930
// prototype free as "void free(void*)"
931-
FunctionCallee FreeFunc = M->getOrInsertFunction("free", VoidTy, IntPtrTy);
931+
FunctionCallee FreeFunc = M->getOrInsertFunction("free", VoidTy, VoidPtrTy);
932932
CallInst *Result = nullptr;
933-
Value *PtrCast = Source;
934-
if (InsertBefore) {
935-
if (Source->getType() != IntPtrTy)
936-
PtrCast = new BitCastInst(Source, IntPtrTy, "", InsertBefore);
937-
Result = CallInst::Create(FreeFunc, PtrCast, Bundles, "", InsertBefore);
938-
} else {
939-
if (Source->getType() != IntPtrTy)
940-
PtrCast = new BitCastInst(Source, IntPtrTy, "", InsertAtEnd);
941-
Result = CallInst::Create(FreeFunc, PtrCast, Bundles, "");
942-
}
933+
if (InsertBefore)
934+
Result = CallInst::Create(FreeFunc, Source, Bundles, "", InsertBefore);
935+
else
936+
Result = CallInst::Create(FreeFunc, Source, Bundles, "");
943937
Result->setTailCall();
944938
if (Function *F = dyn_cast<Function>(FreeFunc.getCallee()))
945939
Result->setCallingConv(F->getCallingConv());

llvm/lib/IR/Type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ static TargetTypeInfo getTargetTypeInfo(const TargetExtType *Ty) {
835835
LLVMContext &C = Ty->getContext();
836836
StringRef Name = Ty->getName();
837837
if (Name.startswith("spirv."))
838-
return TargetTypeInfo(Type::getInt8PtrTy(C, 0), TargetExtType::HasZeroInit,
838+
return TargetTypeInfo(PointerType::get(C, 0), TargetExtType::HasZeroInit,
839839
TargetExtType::CanBeGlobal);
840840

841841
// Opaque types in the AArch64 name space.

llvm/lib/IR/Verifier.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,8 +796,7 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) {
796796
if (ArrayType *ATy = dyn_cast<ArrayType>(GV.getValueType())) {
797797
StructType *STy = dyn_cast<StructType>(ATy->getElementType());
798798
PointerType *FuncPtrTy =
799-
FunctionType::get(Type::getVoidTy(Context), false)->
800-
getPointerTo(DL.getProgramAddressSpace());
799+
PointerType::get(Context, DL.getProgramAddressSpace());
801800
Check(STy && (STy->getNumElements() == 2 || STy->getNumElements() == 3) &&
802801
STy->getTypeAtIndex(0u)->isIntegerTy(32) &&
803802
STy->getTypeAtIndex(1) == FuncPtrTy,

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14984,15 +14984,6 @@ bool AArch64TargetLowering::lowerInterleavedLoad(
1498414984
// The base address of the load.
1498514985
Value *BaseAddr = LI->getPointerOperand();
1498614986

14987-
if (NumLoads > 1) {
14988-
// We will compute the pointer operand of each load from the original base
14989-
// address using GEPs. Cast the base address to a pointer to the scalar
14990-
// element type.
14991-
BaseAddr = Builder.CreateBitCast(
14992-
BaseAddr,
14993-
LDVTy->getElementType()->getPointerTo(LI->getPointerAddressSpace()));
14994-
}
14995-
1499614987
Type *PtrTy = LI->getPointerOperandType();
1499714988
Type *PredTy = VectorType::get(Type::getInt1Ty(LDVTy->getContext()),
1499814989
LDVTy->getElementCount());
@@ -15030,11 +15021,9 @@ bool AArch64TargetLowering::lowerInterleavedLoad(
1503015021

1503115022
CallInst *LdN;
1503215023
if (UseScalable)
15033-
LdN = Builder.CreateCall(
15034-
LdNFunc, {PTrue, Builder.CreateBitCast(BaseAddr, PtrTy)}, "ldN");
15024+
LdN = Builder.CreateCall(LdNFunc, {PTrue, BaseAddr}, "ldN");
1503515025
else
15036-
LdN = Builder.CreateCall(LdNFunc, Builder.CreateBitCast(BaseAddr, PtrTy),
15037-
"ldN");
15026+
LdN = Builder.CreateCall(LdNFunc, BaseAddr, "ldN");
1503815027

1503915028
// Extract and store the sub-vectors returned by the load intrinsic.
1504015029
for (unsigned i = 0; i < Shuffles.size(); i++) {
@@ -15154,15 +15143,6 @@ bool AArch64TargetLowering::lowerInterleavedStore(StoreInst *SI,
1515415143
// The base address of the store.
1515515144
Value *BaseAddr = SI->getPointerOperand();
1515615145

15157-
if (NumStores > 1) {
15158-
// We will compute the pointer operand of each store from the original base
15159-
// address using GEPs. Cast the base address to a pointer to the scalar
15160-
// element type.
15161-
BaseAddr = Builder.CreateBitCast(
15162-
BaseAddr,
15163-
SubVecTy->getElementType()->getPointerTo(SI->getPointerAddressSpace()));
15164-
}
15165-
1516615146
auto Mask = SVI->getShuffleMask();
1516715147

1516815148
// Sanity check if all the indices are NOT in range.
@@ -15245,7 +15225,7 @@ bool AArch64TargetLowering::lowerInterleavedStore(StoreInst *SI,
1524515225
BaseAddr = Builder.CreateConstGEP1_32(SubVecTy->getElementType(),
1524615226
BaseAddr, LaneLen * Factor);
1524715227

15248-
Ops.push_back(Builder.CreateBitCast(BaseAddr, PtrTy));
15228+
Ops.push_back(BaseAddr);
1524915229
Builder.CreateCall(StNFunc, Ops);
1525015230
}
1525115231
return true;
@@ -24393,7 +24373,6 @@ Value *AArch64TargetLowering::emitLoadLinked(IRBuilderBase &Builder,
2439324373
IsAcquire ? Intrinsic::aarch64_ldaxp : Intrinsic::aarch64_ldxp;
2439424374
Function *Ldxr = Intrinsic::getDeclaration(M, Int);
2439524375

24396-
Addr = Builder.CreateBitCast(Addr, Type::getInt8PtrTy(M->getContext()));
2439724376
Value *LoHi = Builder.CreateCall(Ldxr, Addr, "lohi");
2439824377

2439924378
Value *Lo = Builder.CreateExtractValue(LoHi, 0, "lo");
@@ -24442,7 +24421,6 @@ Value *AArch64TargetLowering::emitStoreConditional(IRBuilderBase &Builder,
2444224421

2444324422
Value *Lo = Builder.CreateTrunc(Val, Int64Ty, "lo");
2444424423
Value *Hi = Builder.CreateTrunc(Builder.CreateLShr(Val, 64), Int64Ty, "hi");
24445-
Addr = Builder.CreateBitCast(Addr, Type::getInt8PtrTy(M->getContext()));
2444624424
return Builder.CreateCall(Stxr, {Lo, Hi, Addr});
2444724425
}
2444824426

@@ -24490,7 +24468,7 @@ static Value *UseTlsOffset(IRBuilderBase &IRB, unsigned Offset) {
2449024468
return IRB.CreatePointerCast(
2449124469
IRB.CreateConstGEP1_32(IRB.getInt8Ty(), IRB.CreateCall(ThreadPointerFunc),
2449224470
Offset),
24493-
IRB.getInt8PtrTy()->getPointerTo(0));
24471+
IRB.getPtrTy(0));
2449424472
}
2449524473

2449624474
Value *AArch64TargetLowering::getIRStackGuard(IRBuilderBase &IRB) const {

llvm/lib/Target/AArch64/AArch64StackTagging.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ void AArch64StackTagging::tagAlloca(AllocaInst *AI, Instruction *InsertBefore,
435435
void AArch64StackTagging::untagAlloca(AllocaInst *AI, Instruction *InsertBefore,
436436
uint64_t Size) {
437437
IRBuilder<> IRB(InsertBefore);
438-
IRB.CreateCall(SetTagFunc, {IRB.CreatePointerCast(AI, IRB.getInt8PtrTy()),
438+
IRB.CreateCall(SetTagFunc, {IRB.CreatePointerCast(AI, IRB.getPtrTy()),
439439
ConstantInt::get(IRB.getInt64Ty(), Size)});
440440
}
441441

@@ -564,7 +564,7 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
564564
}
565565
} else {
566566
uint64_t Size = *Info.AI->getAllocationSize(*DL);
567-
Value *Ptr = IRB.CreatePointerCast(TagPCall, IRB.getInt8PtrTy());
567+
Value *Ptr = IRB.CreatePointerCast(TagPCall, IRB.getPtrTy());
568568
tagAlloca(AI, &*IRB.GetInsertPoint(), Ptr, Size);
569569
for (auto *RI : SInfo.RetVec) {
570570
untagAlloca(AI, RI, Size);

llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,7 @@ bool SVEIntrinsicOpts::optimizePredicateStore(Instruction *I) {
325325
IRBuilder<> Builder(I->getContext());
326326
Builder.SetInsertPoint(I);
327327

328-
auto *PtrBitCast = Builder.CreateBitCast(
329-
Store->getPointerOperand(),
330-
PredType->getPointerTo(Store->getPointerAddressSpace()));
331-
Builder.CreateStore(BitCast->getOperand(0), PtrBitCast);
328+
Builder.CreateStore(BitCast->getOperand(0), Store->getPointerOperand());
332329

333330
Store->eraseFromParent();
334331
if (IntrI->getNumUses() == 0)
@@ -385,10 +382,7 @@ bool SVEIntrinsicOpts::optimizePredicateLoad(Instruction *I) {
385382
IRBuilder<> Builder(I->getContext());
386383
Builder.SetInsertPoint(Load);
387384

388-
auto *PtrBitCast = Builder.CreateBitCast(
389-
Load->getPointerOperand(),
390-
PredType->getPointerTo(Load->getPointerAddressSpace()));
391-
auto *LoadPred = Builder.CreateLoad(PredType, PtrBitCast);
385+
auto *LoadPred = Builder.CreateLoad(PredType, Load->getPointerOperand());
392386

393387
BitCast->replaceAllUsesWith(LoadPred);
394388
BitCast->eraseFromParent();

llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ void MetadataStreamerYamlV2::emitHiddenKernelArgs(const Function &Func,
392392
if (HiddenArgNumBytes >= 24)
393393
emitKernelArg(DL, Int64Ty, Align(8), ValueKind::HiddenGlobalOffsetZ);
394394

395-
auto Int8PtrTy = Type::getInt8PtrTy(Func.getContext(),
396-
AMDGPUAS::GLOBAL_ADDRESS);
395+
auto Int8PtrTy =
396+
PointerType::get(Func.getContext(), AMDGPUAS::GLOBAL_ADDRESS);
397397

398398
if (HiddenArgNumBytes >= 32) {
399399
// We forbid the use of features requiring hostcall when compiling OpenCL
@@ -824,7 +824,7 @@ void MetadataStreamerMsgPackV3::emitHiddenKernelArgs(
824824
Args);
825825

826826
auto Int8PtrTy =
827-
Type::getInt8PtrTy(Func.getContext(), AMDGPUAS::GLOBAL_ADDRESS);
827+
PointerType::get(Func.getContext(), AMDGPUAS::GLOBAL_ADDRESS);
828828

829829
if (HiddenArgNumBytes >= 32) {
830830
// We forbid the use of features requiring hostcall when compiling OpenCL
@@ -1044,7 +1044,7 @@ void MetadataStreamerMsgPackV5::emitHiddenKernelArgs(
10441044

10451045
Offset += 6; // Reserved.
10461046
auto Int8PtrTy =
1047-
Type::getInt8PtrTy(Func.getContext(), AMDGPUAS::GLOBAL_ADDRESS);
1047+
PointerType::get(Func.getContext(), AMDGPUAS::GLOBAL_ADDRESS);
10481048

10491049
if (M->getNamedMetadata("llvm.printf.fmts")) {
10501050
emitKernelArg(DL, Int8PtrTy, Align(8), "hidden_printf_buffer", Offset,

0 commit comments

Comments
 (0)