@@ -739,8 +739,9 @@ SPIRVType *LLVMToSPIRVBase::transPointerType(Type *ET, unsigned AddrSpc) {
739739 SPIRVType *TranslatedTy = nullptr ;
740740 if (ET->isPointerTy () &&
741741 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 );
744745 } else {
745746 ElementType = transType (ET);
746747 TranslatedTy = transPointerType (ElementType, AddrSpc);
@@ -765,8 +766,9 @@ SPIRVType *LLVMToSPIRVBase::transPointerType(SPIRVType *ET, unsigned AddrSpc) {
765766 return transPointerType (ET, SPIRAS_Private);
766767 if (BM->isAllowedToUseExtension (ExtensionID::SPV_KHR_untyped_pointers) &&
767768 !(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 );
770772 } else {
771773 TranslatedTy = BM->addPointerType (
772774 SPIRSPIRVAddrSpaceMap::map (static_cast <SPIRAddressSpace>(AddrSpc)), ET);
@@ -2348,10 +2350,8 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
23482350 }
23492351 SPIRVType *VarTy = TranslatedTy;
23502352 if (V->getType ()->getPointerAddressSpace () == SPIRAS_Generic) {
2351- // TODO: refactor addPointerType and addUntypedPointerKHRType in one
2352- // method if possible.
23532353 if (TranslatedTy->isTypeUntypedPointerKHR ())
2354- VarTy = BM->addUntypedPointerKHRType (StorageClassFunction);
2354+ VarTy = BM->addPointerType (StorageClassFunction, nullptr );
23552355 else
23562356 VarTy = BM->addPointerType (StorageClassFunction,
23572357 TranslatedTy->getPointerElementType ());
@@ -2698,11 +2698,8 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
26982698SPIRVType *LLVMToSPIRVBase::mapType (Type *T, SPIRVType *BT) {
26992699 assert (!T->isPointerTy () && " Pointer types cannot be stored in the type map" );
27002700 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" );
27032702 SPIRVDBG (dbgs () << " [mapType] " << *T << " => " ; spvdbgs () << *BT << ' \n ' );
2704- if (!EmplaceStatus.second )
2705- return TypeMap[T];
27062703 return BT;
27072704}
27082705
@@ -4303,8 +4300,8 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
43034300 SPIRVType *IntegralTy = transType (II->getType ()->getStructElementType (1 ));
43044301 // IntegralTy is the type of the result. We want to create a pointer to this
43054302 // 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 );
43084305 // We need to use the entry BB of the function calling llvm.modf.*, instead
43094306 // of the current BB. For that, we'll find current BB's parent and get its
43104307 // first BB, which is the entry BB of the function.
@@ -4830,7 +4827,7 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
48304827 auto *SrcTy = PtrOp->getType ();
48314828 SPIRVType *DstTy = nullptr ;
48324829 if (SrcTy->isTypeUntypedPointerKHR ())
4833- DstTy = BM->addUntypedPointerKHRType (StorageClassFunction);
4830+ DstTy = BM->addPointerType (StorageClassFunction, nullptr );
48344831 else
48354832 DstTy = BM->addPointerType (StorageClassFunction,
48364833 SrcTy->getPointerElementType ());
0 commit comments