@@ -325,8 +325,7 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
325
325
// A pointer to image or pipe type in LLVM is translated to a SPIRV
326
326
// (non-pointer) image or pipe type.
327
327
if (T->isPointerTy ()) {
328
- auto *ET = T->isOpaquePointerTy () ? Type::getInt8Ty (T->getContext ())
329
- : T->getNonOpaquePointerElementType ();
328
+ auto *ET = Type::getInt8Ty (T->getContext ());
330
329
auto AddrSpc = T->getPointerAddressSpace ();
331
330
return transPointerType (ET, AddrSpc);
332
331
}
@@ -375,7 +374,7 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
375
374
ConstantInt::get (getSizetType (), T->getArrayNumElements (), false ),
376
375
nullptr )));
377
376
mapType (T, TransType);
378
- if (ElTy->isOpaquePointerTy ()) {
377
+ if (ElTy->isPointerTy ()) {
379
378
mapType (
380
379
ArrayType::get (TypedPointerType::get (Type::getInt8Ty (*Ctx),
381
380
ElTy->getPointerAddressSpace ()),
@@ -713,9 +712,7 @@ SPIRVType *LLVMToSPIRVBase::transSPIRVOpaqueType(StringRef STName,
713
712
714
713
SPIRVType *LLVMToSPIRVBase::transScavengedType (Value *V) {
715
714
if (auto *F = dyn_cast<Function>(V)) {
716
- FunctionType *FnTy = F->getType ()->isOpaquePointerTy ()
717
- ? Scavenger->getFunctionType (F)
718
- : F->getFunctionType ();
715
+ FunctionType *FnTy = Scavenger->getFunctionType (F);
719
716
SPIRVType *RT = transType (FnTy->getReturnType ());
720
717
std::vector<SPIRVType *> PT;
721
718
for (Argument &Arg : F->args ()) {
@@ -1808,11 +1805,6 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
1808
1805
assert (BV);
1809
1806
return mapValue (V, BV);
1810
1807
} else if (ConstantExpr *ConstUE = dyn_cast_or_null<ConstantExpr>(Init)) {
1811
- Value *SpecialInit = unwrapSpecialTypeInitializer (ConstUE);
1812
- if (auto *SpecialGV = dyn_cast_or_null<GlobalValue>(SpecialInit)) {
1813
- Init = SpecialGV;
1814
- Ty = Scavenger->getScavengedType (SpecialGV);
1815
- }
1816
1808
BVarInit = transValue (Init, nullptr );
1817
1809
} else if (ST && isa<UndefValue>(Init)) {
1818
1810
// Undef initializer for LLVM structure be can translated to
@@ -1918,9 +1910,9 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
1918
1910
if (isa<Constant>(V)) {
1919
1911
auto BV = transConstant (V);
1920
1912
assert (BV);
1921
- // Don't store opaque pointer constants in the map--we might reuse the wrong
1922
- // type for (e.g.) a null value if we do so.
1923
- if (V->getType ()->isOpaquePointerTy ())
1913
+ // Don't store pointer constants in the map -- they are opaque and thus we
1914
+ // might reuse the wrong type (Example: a null value) if we do so.
1915
+ if (V->getType ()->isPointerTy ())
1924
1916
return BV;
1925
1917
return mapValue (V, BV);
1926
1918
}
@@ -2166,8 +2158,6 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
2166
2158
}
2167
2159
2168
2160
if (UnaryInstruction *U = dyn_cast<UnaryInstruction>(V)) {
2169
- if (auto *Init = unwrapSpecialTypeInitializer (U))
2170
- return mapValue (V, transValue (Init, BB));
2171
2161
auto UI = transUnaryInst (U, BB);
2172
2162
return mapValue (V, UI ? UI : transValue (U->getOperand (0 ), BB));
2173
2163
}
@@ -2779,12 +2769,6 @@ SPIRVValue *LLVMToSPIRVBase::oclTransSpvcCastSampler(CallInst *CI,
2779
2769
auto FT = F->getFunctionType ();
2780
2770
auto RT = FT->getReturnType ();
2781
2771
assert (FT->getNumParams () == 1 );
2782
- if (RT->isPointerTy () && !RT->isOpaquePointerTy ()) {
2783
- StructType *ST = dyn_cast<StructType>(RT->getNonOpaquePointerElementType ());
2784
- (void )ST;
2785
- assert (isSPIRVStructType (ST, kSPIRVTypeName ::Sampler) ||
2786
- (ST->isOpaque () && ST->getName () == kSPR2TypeName ::Sampler));
2787
- }
2788
2772
assert (FT->getParamType (0 )->isIntegerTy () && " Invalid sampler type" );
2789
2773
auto Arg = CI->getArgOperand (0 );
2790
2774
@@ -2923,7 +2907,7 @@ void processOptionalAnnotationInfo(Constant *Const,
2923
2907
void processAnnotationString (IntrinsicInst *II, std::string &AnnotationString) {
2924
2908
auto *StrVal = II->getArgOperand (1 );
2925
2909
auto *StrValTy = StrVal->getType ();
2926
- if (StrValTy->isOpaquePointerTy ()) {
2910
+ if (StrValTy->isPointerTy ()) {
2927
2911
StringRef StrRef;
2928
2912
if (getConstantStringInfo (dyn_cast<Constant>(StrVal), StrRef))
2929
2913
AnnotationString += StrRef.str ();
0 commit comments