@@ -735,8 +735,9 @@ SPIRVType *LLVMToSPIRVBase::transPointerType(Type *ET, unsigned AddrSpc) {
735735 SPIRVType *TranslatedTy = nullptr ;
736736 if (ET->isPointerTy () &&
737737 BM->isAllowedToUseExtension (ExtensionID::SPV_KHR_untyped_pointers)) {
738- TranslatedTy = BM->addUntypedPointerKHRType (
739- SPIRSPIRVAddrSpaceMap::map (static_cast <SPIRAddressSpace>(AddrSpc)));
738+ TranslatedTy = BM->addPointerType (
739+ SPIRSPIRVAddrSpaceMap::map (static_cast <SPIRAddressSpace>(AddrSpc)),
740+ nullptr );
740741 } else {
741742 ElementType = transType (ET);
742743 TranslatedTy = transPointerType (ElementType, AddrSpc);
@@ -761,8 +762,9 @@ SPIRVType *LLVMToSPIRVBase::transPointerType(SPIRVType *ET, unsigned AddrSpc) {
761762 return transPointerType (ET, SPIRAS_Private);
762763 if (BM->isAllowedToUseExtension (ExtensionID::SPV_KHR_untyped_pointers) &&
763764 !(ET->isTypeArray () || ET->isTypeVector () || ET->isSPIRVOpaqueType ())) {
764- TranslatedTy = BM->addUntypedPointerKHRType (
765- SPIRSPIRVAddrSpaceMap::map (static_cast <SPIRAddressSpace>(AddrSpc)));
765+ TranslatedTy = BM->addPointerType (
766+ SPIRSPIRVAddrSpaceMap::map (static_cast <SPIRAddressSpace>(AddrSpc)),
767+ nullptr );
766768 } else {
767769 TranslatedTy = BM->addPointerType (
768770 SPIRSPIRVAddrSpaceMap::map (static_cast <SPIRAddressSpace>(AddrSpc)), ET);
@@ -2347,10 +2349,8 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
23472349 }
23482350 SPIRVType *VarTy = TranslatedTy;
23492351 if (V->getType ()->getPointerAddressSpace () == SPIRAS_Generic) {
2350- // TODO: refactor addPointerType and addUntypedPointerKHRType in one
2351- // method if possible.
23522352 if (TranslatedTy->isTypeUntypedPointerKHR ())
2353- VarTy = BM->addUntypedPointerKHRType (StorageClassFunction);
2353+ VarTy = BM->addPointerType (StorageClassFunction, nullptr );
23542354 else
23552355 VarTy = BM->addPointerType (StorageClassFunction,
23562356 TranslatedTy->getPointerElementType ());
@@ -2697,11 +2697,8 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
26972697SPIRVType *LLVMToSPIRVBase::mapType (Type *T, SPIRVType *BT) {
26982698 assert (!T->isPointerTy () && " Pointer types cannot be stored in the type map" );
26992699 auto EmplaceStatus = TypeMap.try_emplace (T, BT);
2700- // TODO: Uncomment the assertion, once the type mapping issue is resolved
2701- // assert(EmplaceStatus.second && "The type was already added to the map");
2700+ assert (EmplaceStatus.second && " The type was already added to the map" );
27022701 SPIRVDBG (dbgs () << " [mapType] " << *T << " => " ; spvdbgs () << *BT << ' \n ' );
2703- if (!EmplaceStatus.second )
2704- return TypeMap[T];
27052702 return BT;
27062703}
27072704
@@ -4302,8 +4299,8 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
43024299 SPIRVType *IntegralTy = transType (II->getType ()->getStructElementType (1 ));
43034300 // IntegralTy is the type of the result. We want to create a pointer to this
43044301 // that we can pass to OpenCLLIB::modf to store the integral part.
4305- SPIRVTypePointer *IntegralPtrTy =
4306- BM-> addPointerType (StorageClassFunction, IntegralTy );
4302+ SPIRVType *GenericPtrTy = BM-> addPointerType (StorageClassFunction, IntegralTy);
4303+ auto *IntegralPtrTy = dyn_cast<SPIRVTypePointer>(GenericPtrTy );
43074304 // We need to use the entry BB of the function calling llvm.modf.*, instead
43084305 // of the current BB. For that, we'll find current BB's parent and get its
43094306 // first BB, which is the entry BB of the function.
@@ -4829,7 +4826,7 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
48294826 auto *SrcTy = PtrOp->getType ();
48304827 SPIRVType *DstTy = nullptr ;
48314828 if (SrcTy->isTypeUntypedPointerKHR ())
4832- DstTy = BM->addUntypedPointerKHRType (StorageClassFunction);
4829+ DstTy = BM->addPointerType (StorageClassFunction, nullptr );
48334830 else
48344831 DstTy = BM->addPointerType (StorageClassFunction,
48354832 SrcTy->getPointerElementType ());
0 commit comments