@@ -329,8 +329,7 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
329
329
// A pointer to image or pipe type in LLVM is translated to a SPIRV
330
330
// (non-pointer) image or pipe type.
331
331
if (T->isPointerTy ()) {
332
- auto *ET = T->isOpaquePointerTy () ? Type::getInt8Ty (T->getContext ())
333
- : T->getNonOpaquePointerElementType ();
332
+ auto *ET = Type::getInt8Ty (T->getContext ());
334
333
auto AddrSpc = T->getPointerAddressSpace ();
335
334
return transPointerType (ET, AddrSpc);
336
335
}
@@ -379,7 +378,7 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
379
378
ConstantInt::get (getSizetType (), T->getArrayNumElements (), false ),
380
379
nullptr )));
381
380
mapType (T, TransType);
382
- if (ElTy->isOpaquePointerTy ()) {
381
+ if (ElTy->isPointerTy ()) {
383
382
mapType (
384
383
ArrayType::get (TypedPointerType::get (Type::getInt8Ty (*Ctx),
385
384
ElTy->getPointerAddressSpace ()),
@@ -717,9 +716,7 @@ SPIRVType *LLVMToSPIRVBase::transSPIRVOpaqueType(StringRef STName,
717
716
718
717
SPIRVType *LLVMToSPIRVBase::transScavengedType (Value *V) {
719
718
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);
723
720
SPIRVType *RT = transType (FnTy->getReturnType ());
724
721
std::vector<SPIRVType *> PT;
725
722
for (Argument &Arg : F->args ()) {
@@ -1824,11 +1821,6 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
1824
1821
assert (BV);
1825
1822
return mapValue (V, BV);
1826
1823
} 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
- }
1832
1824
BVarInit = transValue (Init, nullptr );
1833
1825
} else if (ST && isa<UndefValue>(Init)) {
1834
1826
// Undef initializer for LLVM structure be can translated to
@@ -1983,9 +1975,9 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
1983
1975
if (isa<Constant>(V)) {
1984
1976
auto BV = transConstant (V);
1985
1977
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 ())
1989
1981
return BV;
1990
1982
return mapValue (V, BV);
1991
1983
}
@@ -2231,8 +2223,6 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
2231
2223
}
2232
2224
2233
2225
if (UnaryInstruction *U = dyn_cast<UnaryInstruction>(V)) {
2234
- if (auto *Init = unwrapSpecialTypeInitializer (U))
2235
- return mapValue (V, transValue (Init, BB));
2236
2226
auto UI = transUnaryInst (U, BB);
2237
2227
return mapValue (V, UI ? UI : transValue (U->getOperand (0 ), BB));
2238
2228
}
@@ -2844,12 +2834,6 @@ SPIRVValue *LLVMToSPIRVBase::oclTransSpvcCastSampler(CallInst *CI,
2844
2834
auto FT = F->getFunctionType ();
2845
2835
auto RT = FT->getReturnType ();
2846
2836
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
- }
2853
2837
assert (FT->getParamType (0 )->isIntegerTy () && " Invalid sampler type" );
2854
2838
auto Arg = CI->getArgOperand (0 );
2855
2839
@@ -2988,7 +2972,7 @@ void processOptionalAnnotationInfo(Constant *Const,
2988
2972
void processAnnotationString (IntrinsicInst *II, std::string &AnnotationString) {
2989
2973
auto *StrVal = II->getArgOperand (1 );
2990
2974
auto *StrValTy = StrVal->getType ();
2991
- if (StrValTy->isOpaquePointerTy ()) {
2975
+ if (StrValTy->isPointerTy ()) {
2992
2976
StringRef StrRef;
2993
2977
if (getConstantStringInfo (dyn_cast<Constant>(StrVal), StrRef))
2994
2978
AnnotationString += StrRef.str ();
0 commit comments