Skip to content

Commit 0d9ff2c

Browse files
asudarsajsji
authored andcommitted
Remove deprecated functions: setOpaquePointer, isOpaqueOrPointeeTypeMatches (#2108)
Removes use of setOpaquePointer --> Can be removed without any side effect. isOpaqueOrPointeeTypeMatches --> is always true. Thanks Signed-off-by: Arvind Sudarsanam <[email protected]> Original commit: KhronosGroup/SPIRV-LLVM-Translator@42d7c59
1 parent 201285f commit 0d9ff2c

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

llvm-spirv/lib/SPIRV/SPIRVBuiltinHelper.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,8 @@ Value *BuiltinCallHelper::addSPIRVCall(IRBuilder<> &Builder, spv::Op Opcode,
236236
// Copy the types into the mangling info.
237237
BuiltinFuncMangleInfo BtnInfo;
238238
for (unsigned I = 0; I < ArgTys.size(); I++) {
239-
if (Args[I]->getType()->isPointerTy()) {
240-
assert(cast<PointerType>(Args[I]->getType())
241-
->isOpaqueOrPointeeTypeMatches(
242-
cast<TypedPointerType>(ArgTys[I])->getElementType()));
239+
if (Args[I]->getType()->isPointerTy())
243240
BtnInfo.getTypeMangleInfo(I).PointerTy = ArgTys[I];
244-
}
245241
}
246242

247243
// Create the function and the call.

llvm-spirv/lib/SPIRV/SPIRVUtil.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,8 @@ std::string mapLLVMTypeToOCLType(const Type *Ty, bool Signed, Type *PET) {
151151
// value of some SPIR-V instructions may be represented as pointer to a struct
152152
// in LLVM IR) we can mangle the type.
153153
BuiltinFuncMangleInfo MangleInfo;
154-
if (Ty->isPointerTy()) {
155-
assert(cast<PointerType>(const_cast<Type *>(Ty))
156-
->isOpaqueOrPointeeTypeMatches(PET));
154+
if (Ty->isPointerTy())
157155
Ty = TypedPointerType::get(PET, Ty->getPointerAddressSpace());
158-
}
159156
std::string MangledName =
160157
mangleBuiltin("", const_cast<Type *>(Ty), &MangleInfo);
161158
// Remove "_Z0"(3 characters) from the front of the name
@@ -1000,12 +997,9 @@ CallInst *addCallInstSPIRV(Module *M, StringRef FuncName, Type *RetTy,
1000997
Instruction *Pos, StringRef InstName) {
1001998
BuiltinFuncMangleInfo BtnInfo;
1002999
for (unsigned I = 0; I < PointerElementTypes.size(); I++) {
1003-
if (Args[I]->getType()->isPointerTy()) {
1004-
assert(cast<PointerType>(Args[I]->getType())
1005-
->isOpaqueOrPointeeTypeMatches(PointerElementTypes[I]));
1000+
if (Args[I]->getType()->isPointerTy())
10061001
BtnInfo.getTypeMangleInfo(I).PointerTy = TypedPointerType::get(
10071002
PointerElementTypes[I], Args[I]->getType()->getPointerAddressSpace());
1008-
}
10091003
}
10101004
return addCallInst(M, FuncName, RetTy, Args, Attrs, Pos, &BtnInfo, InstName);
10111005
}
@@ -1495,8 +1489,6 @@ Value *getScalarOrArrayConstantInt(Instruction *Pos, Type *T, unsigned Len,
14951489
unsigned PointerSize =
14961490
Pos->getModule()->getDataLayout().getPointerTypeSizeInBits(T);
14971491
auto *ET = Type::getIntNTy(T->getContext(), PointerSize);
1498-
assert(cast<PointerType>(T)->isOpaqueOrPointeeTypeMatches(ET) &&
1499-
"Pointer-to-non-size_t arguments are not valid for this call");
15001492
auto AT = ArrayType::get(ET, Len);
15011493
std::vector<Constant *> EV(Len, ConstantInt::get(ET, V, IsSigned));
15021494
auto CA = ConstantArray::get(AT, EV);

llvm-spirv/tools/llvm-spirv/llvm-spirv.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,7 @@ static bool isFileEmpty(const std::string &FileName) {
387387

388388
static int convertSPIRVToLLVM(const SPIRV::TranslatorOpts &Opts) {
389389
LLVMContext Context;
390-
Context.setOpaquePointers(EmitOpaquePointers);
391-
390+
392391
std::ifstream IFS(InputFile, std::ios::binary);
393392
Module *M;
394393
std::string Err;

0 commit comments

Comments
 (0)