@@ -739,8 +739,9 @@ SPIRVType *LLVMToSPIRVBase::transPointerType(Type *ET, unsigned AddrSpc) {
739
739
SPIRVType *TranslatedTy = nullptr ;
740
740
if (ET->isPointerTy () &&
741
741
BM->isAllowedToUseExtension (ExtensionID::SPV_KHR_untyped_pointers)) {
742
- TranslatedTy = BM->addUntypedPointerKHRType (
743
- SPIRSPIRVAddrSpaceMap::map (static_cast <SPIRAddressSpace>(AddrSpc)));
742
+ TranslatedTy = BM->addPointerType (
743
+ SPIRSPIRVAddrSpaceMap::map (static_cast <SPIRAddressSpace>(AddrSpc)),
744
+ nullptr );
744
745
} else {
745
746
ElementType = transType (ET);
746
747
TranslatedTy = transPointerType (ElementType, AddrSpc);
@@ -765,8 +766,9 @@ SPIRVType *LLVMToSPIRVBase::transPointerType(SPIRVType *ET, unsigned AddrSpc) {
765
766
return transPointerType (ET, SPIRAS_Private);
766
767
if (BM->isAllowedToUseExtension (ExtensionID::SPV_KHR_untyped_pointers) &&
767
768
!(ET->isTypeArray () || ET->isTypeVector () || ET->isSPIRVOpaqueType ())) {
768
- TranslatedTy = BM->addUntypedPointerKHRType (
769
- SPIRSPIRVAddrSpaceMap::map (static_cast <SPIRAddressSpace>(AddrSpc)));
769
+ TranslatedTy = BM->addPointerType (
770
+ SPIRSPIRVAddrSpaceMap::map (static_cast <SPIRAddressSpace>(AddrSpc)),
771
+ nullptr );
770
772
} else {
771
773
TranslatedTy = BM->addPointerType (
772
774
SPIRSPIRVAddrSpaceMap::map (static_cast <SPIRAddressSpace>(AddrSpc)), ET);
@@ -2348,10 +2350,8 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
2348
2350
}
2349
2351
SPIRVType *VarTy = TranslatedTy;
2350
2352
if (V->getType ()->getPointerAddressSpace () == SPIRAS_Generic) {
2351
- // TODO: refactor addPointerType and addUntypedPointerKHRType in one
2352
- // method if possible.
2353
2353
if (TranslatedTy->isTypeUntypedPointerKHR ())
2354
- VarTy = BM->addUntypedPointerKHRType (StorageClassFunction);
2354
+ VarTy = BM->addPointerType (StorageClassFunction, nullptr );
2355
2355
else
2356
2356
VarTy = BM->addPointerType (StorageClassFunction,
2357
2357
TranslatedTy->getPointerElementType ());
@@ -2698,11 +2698,8 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
2698
2698
SPIRVType *LLVMToSPIRVBase::mapType (Type *T, SPIRVType *BT) {
2699
2699
assert (!T->isPointerTy () && " Pointer types cannot be stored in the type map" );
2700
2700
auto EmplaceStatus = TypeMap.try_emplace (T, BT);
2701
- // TODO: Uncomment the assertion, once the type mapping issue is resolved
2702
- // assert(EmplaceStatus.second && "The type was already added to the map");
2701
+ assert (EmplaceStatus.second && " The type was already added to the map" );
2703
2702
SPIRVDBG (dbgs () << " [mapType] " << *T << " => " ; spvdbgs () << *BT << ' \n ' );
2704
- if (!EmplaceStatus.second )
2705
- return TypeMap[T];
2706
2703
return BT;
2707
2704
}
2708
2705
@@ -4303,8 +4300,8 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
4303
4300
SPIRVType *IntegralTy = transType (II->getType ()->getStructElementType (1 ));
4304
4301
// IntegralTy is the type of the result. We want to create a pointer to this
4305
4302
// that we can pass to OpenCLLIB::modf to store the integral part.
4306
- SPIRVTypePointer *IntegralPtrTy =
4307
- BM-> addPointerType (StorageClassFunction, IntegralTy );
4303
+ SPIRVType *GenericPtrTy = BM-> addPointerType (StorageClassFunction, IntegralTy);
4304
+ auto *IntegralPtrTy = dyn_cast<SPIRVTypePointer>(GenericPtrTy );
4308
4305
// We need to use the entry BB of the function calling llvm.modf.*, instead
4309
4306
// of the current BB. For that, we'll find current BB's parent and get its
4310
4307
// first BB, which is the entry BB of the function.
@@ -4830,7 +4827,7 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
4830
4827
auto *SrcTy = PtrOp->getType ();
4831
4828
SPIRVType *DstTy = nullptr ;
4832
4829
if (SrcTy->isTypeUntypedPointerKHR ())
4833
- DstTy = BM->addUntypedPointerKHRType (StorageClassFunction);
4830
+ DstTy = BM->addPointerType (StorageClassFunction, nullptr );
4834
4831
else
4835
4832
DstTy = BM->addPointerType (StorageClassFunction,
4836
4833
SrcTy->getPointerElementType ());
0 commit comments