Skip to content

Commit

Permalink
[NFC] Remove Type::getInt8PtrTy after 7b9d73c2f90 (#2209)
Browse files Browse the repository at this point in the history
Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
  • Loading branch information
MrSidims authored Nov 9, 2023
1 parent c60327f commit 74b2540
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
25 changes: 12 additions & 13 deletions lib/SPIRV/SPIRVReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2535,8 +2535,7 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
SPIRVFPGARegINTELInstBase *BC =
static_cast<SPIRVFPGARegINTELInstBase *>(BV);

PointerType *Int8PtrTyPrivate =
Type::getInt8PtrTy(*Context, SPIRAS_Private);
PointerType *Int8PtrTyPrivate = PointerType::get(*Context, SPIRAS_Private);
IntegerType *Int32Ty = Type::getInt32Ty(*Context);

Value *UndefInt8Ptr = UndefValue::get(Int8PtrTyPrivate);
Expand Down Expand Up @@ -3133,7 +3132,7 @@ SPIRVToLLVM::transOCLBuiltinPostproc(SPIRVInstruction *BI, CallInst *CI,

Value *SPIRVToLLVM::transBlockInvoke(SPIRVValue *Invoke, BasicBlock *BB) {
auto *TranslatedInvoke = transFunction(static_cast<SPIRVFunction *>(Invoke));
auto *Int8PtrTyGen = Type::getInt8PtrTy(*Context, SPIRAS_Generic);
auto *Int8PtrTyGen = PointerType::get(*Context, SPIRAS_Generic);
return CastInst::CreatePointerBitCastOrAddrSpaceCast(TranslatedInvoke,
Int8PtrTyGen, "", BB);
}
Expand All @@ -3147,7 +3146,7 @@ Instruction *SPIRVToLLVM::transWGSizeQueryBI(SPIRVInstruction *BI,

Function *F = M->getFunction(FName);
if (!F) {
auto *Int8PtrTyGen = Type::getInt8PtrTy(*Context, SPIRAS_Generic);
auto *Int8PtrTyGen = PointerType::get(*Context, SPIRAS_Generic);
FunctionType *FT = FunctionType::get(Type::getInt32Ty(*Context),
{Int8PtrTyGen, Int8PtrTyGen}, false);
F = Function::Create(FT, GlobalValue::ExternalLinkage, FName, M);
Expand All @@ -3172,7 +3171,7 @@ Instruction *SPIRVToLLVM::transSGSizeQueryBI(SPIRVInstruction *BI,
auto Ops = BI->getOperands();
Function *F = M->getFunction(FName);
if (!F) {
auto *Int8PtrTyGen = Type::getInt8PtrTy(*Context, SPIRAS_Generic);
auto *Int8PtrTyGen = PointerType::get(*Context, SPIRAS_Generic);
SmallVector<Type *, 3> Tys = {
transType(Ops[0]->getType()), // ndrange
Int8PtrTyGen, // block_invoke
Expand Down Expand Up @@ -3649,7 +3648,7 @@ void SPIRVToLLVM::transIntelFPGADecorations(SPIRVValue *BV, Value *V) {

IRBuilder<> Builder(Inst->getParent());

Type *Int8PtrTyPrivate = Type::getInt8PtrTy(*Context, SPIRAS_Private);
Type *Int8PtrTyPrivate = PointerType::get(*Context, SPIRAS_Private);
IntegerType *Int32Ty = IntegerType::get(*Context, 32);

Value *UndefInt8Ptr = UndefValue::get(Int8PtrTyPrivate);
Expand Down Expand Up @@ -3764,11 +3763,11 @@ void SPIRVToLLVM::transIntelFPGADecorations(SPIRVValue *BV, Value *V) {
GS->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
GS->setSection("llvm.metadata");

Type *ResType = PointerType::getInt8PtrTy(
GV->getContext(), GV->getType()->getPointerAddressSpace());
Type *ResType = PointerType::get(GV->getContext(),
GV->getType()->getPointerAddressSpace());
Constant *C = ConstantExpr::getPointerBitCastOrAddrSpaceCast(GV, ResType);

Type *Int8PtrTyPrivate = Type::getInt8PtrTy(*Context, SPIRAS_Private);
Type *Int8PtrTyPrivate = PointerType::get(*Context, SPIRAS_Private);
IntegerType *Int32Ty = Type::getInt32Ty(*Context);

llvm::Constant *Fields[5] = {
Expand Down Expand Up @@ -3824,12 +3823,12 @@ void SPIRVToLLVM::transUserSemantic(SPIRV::SPIRVFunction *Fun) {
GS->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
GS->setSection("llvm.metadata");

Type *ResType = PointerType::getInt8PtrTy(
V->getContext(), V->getType()->getPointerAddressSpace());
Type *ResType = PointerType::get(V->getContext(),
V->getType()->getPointerAddressSpace());
Constant *C =
ConstantExpr::getPointerBitCastOrAddrSpaceCast(TransFun, ResType);

Type *Int8PtrTyPrivate = Type::getInt8PtrTy(*Context, SPIRAS_Private);
Type *Int8PtrTyPrivate = PointerType::get(*Context, SPIRAS_Private);
IntegerType *Int32Ty = Type::getInt32Ty(*Context);

llvm::Constant *Fields[5] = {
Expand Down Expand Up @@ -4013,7 +4012,7 @@ void SPIRVToLLVM::createCXXStructor(const char *ListName,
Type *PriorityTy = Type::getInt32Ty(*Context);
PointerType *CtorTy = PointerType::getUnqual(
FunctionType::get(Type::getVoidTy(*Context), false));
PointerType *ComdatTy = Type::getInt8PtrTy(*Context);
PointerType *ComdatTy = PointerType::getUnqual(*Context);
StructType *StructorTy = StructType::get(PriorityTy, CtorTy, ComdatTy);

ArrayType *ArrTy = ArrayType::get(StructorTy, Funcs.size());
Expand Down
4 changes: 2 additions & 2 deletions lib/SPIRV/SPIRVUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,11 +1029,11 @@ void makeVector(Instruction *InsPos, std::vector<Value *> &Ops,
}

Constant *castToInt8Ptr(Constant *V, unsigned Addr = 0) {
return ConstantExpr::getBitCast(V, Type::getInt8PtrTy(V->getContext(), Addr));
return ConstantExpr::getBitCast(V, PointerType::get(V->getContext(), Addr));
}

PointerType *getInt8PtrTy(PointerType *T) {
return Type::getInt8PtrTy(T->getContext(), T->getAddressSpace());
return PointerType::get(T->getContext(), T->getAddressSpace());
}

Value *castToInt8Ptr(Value *V, Instruction *Pos) {
Expand Down

0 comments on commit 74b2540

Please sign in to comment.