@@ -329,8 +329,7 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
329329 // A pointer to image or pipe type in LLVM is translated to a SPIRV
330330 // (non-pointer) image or pipe type.
331331 if (T->isPointerTy ()) {
332- auto *ET = T->isOpaquePointerTy () ? Type::getInt8Ty (T->getContext ())
333- : T->getNonOpaquePointerElementType ();
332+ auto *ET = Type::getInt8Ty (T->getContext ());
334333 auto AddrSpc = T->getPointerAddressSpace ();
335334 return transPointerType (ET, AddrSpc);
336335 }
@@ -379,7 +378,7 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
379378 ConstantInt::get (getSizetType (), T->getArrayNumElements (), false ),
380379 nullptr )));
381380 mapType (T, TransType);
382- if (ElTy->isOpaquePointerTy ()) {
381+ if (ElTy->isPointerTy ()) {
383382 mapType (
384383 ArrayType::get (TypedPointerType::get (Type::getInt8Ty (*Ctx),
385384 ElTy->getPointerAddressSpace ()),
@@ -717,9 +716,7 @@ SPIRVType *LLVMToSPIRVBase::transSPIRVOpaqueType(StringRef STName,
717716
718717SPIRVType *LLVMToSPIRVBase::transScavengedType (Value *V) {
719718 if (auto *F = dyn_cast<Function>(V)) {
720- FunctionType *FnTy = F->getType ()->isOpaquePointerTy ()
721- ? Scavenger->getFunctionType (F)
722- : F->getFunctionType ();
719+ FunctionType *FnTy = Scavenger->getFunctionType (F);
723720 SPIRVType *RT = transType (FnTy->getReturnType ());
724721 std::vector<SPIRVType *> PT;
725722 for (Argument &Arg : F->args ()) {
@@ -1824,11 +1821,6 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
18241821 assert (BV);
18251822 return mapValue (V, BV);
18261823 } else if (ConstantExpr *ConstUE = dyn_cast_or_null<ConstantExpr>(Init)) {
1827- Value *SpecialInit = unwrapSpecialTypeInitializer (ConstUE);
1828- if (auto *SpecialGV = dyn_cast_or_null<GlobalValue>(SpecialInit)) {
1829- Init = SpecialGV;
1830- Ty = Scavenger->getScavengedType (SpecialGV);
1831- }
18321824 BVarInit = transValue (Init, nullptr );
18331825 } else if (ST && isa<UndefValue>(Init)) {
18341826 // Undef initializer for LLVM structure be can translated to
@@ -1983,9 +1975,9 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
19831975 if (isa<Constant>(V)) {
19841976 auto BV = transConstant (V);
19851977 assert (BV);
1986- // Don't store opaque pointer constants in the map--we might reuse the wrong
1987- // type for (e.g.) a null value if we do so.
1988- if (V->getType ()->isOpaquePointerTy ())
1978+ // Don't store pointer constants in the map -- they are opaque and thus we
1979+ // might reuse the wrong type (Example: a null value) if we do so.
1980+ if (V->getType ()->isPointerTy ())
19891981 return BV;
19901982 return mapValue (V, BV);
19911983 }
@@ -2231,8 +2223,6 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
22312223 }
22322224
22332225 if (UnaryInstruction *U = dyn_cast<UnaryInstruction>(V)) {
2234- if (auto *Init = unwrapSpecialTypeInitializer (U))
2235- return mapValue (V, transValue (Init, BB));
22362226 auto UI = transUnaryInst (U, BB);
22372227 return mapValue (V, UI ? UI : transValue (U->getOperand (0 ), BB));
22382228 }
@@ -2844,12 +2834,6 @@ SPIRVValue *LLVMToSPIRVBase::oclTransSpvcCastSampler(CallInst *CI,
28442834 auto FT = F->getFunctionType ();
28452835 auto RT = FT->getReturnType ();
28462836 assert (FT->getNumParams () == 1 );
2847- if (RT->isPointerTy () && !RT->isOpaquePointerTy ()) {
2848- StructType *ST = dyn_cast<StructType>(RT->getNonOpaquePointerElementType ());
2849- (void )ST;
2850- assert (isSPIRVStructType (ST, kSPIRVTypeName ::Sampler) ||
2851- (ST->isOpaque () && ST->getName () == kSPR2TypeName ::Sampler));
2852- }
28532837 assert (FT->getParamType (0 )->isIntegerTy () && " Invalid sampler type" );
28542838 auto Arg = CI->getArgOperand (0 );
28552839
@@ -2988,7 +2972,7 @@ void processOptionalAnnotationInfo(Constant *Const,
29882972void processAnnotationString (IntrinsicInst *II, std::string &AnnotationString) {
29892973 auto *StrVal = II->getArgOperand (1 );
29902974 auto *StrValTy = StrVal->getType ();
2991- if (StrValTy->isOpaquePointerTy ()) {
2975+ if (StrValTy->isPointerTy ()) {
29922976 StringRef StrRef;
29932977 if (getConstantStringInfo (dyn_cast<Constant>(StrVal), StrRef))
29942978 AnnotationString += StrRef.str ();
0 commit comments