@@ -735,8 +735,9 @@ SPIRVType *LLVMToSPIRVBase::transPointerType(Type *ET, unsigned AddrSpc) {
735
735
SPIRVType *TranslatedTy = nullptr ;
736
736
if (ET->isPointerTy () &&
737
737
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 );
740
741
} else {
741
742
ElementType = transType (ET);
742
743
TranslatedTy = transPointerType (ElementType, AddrSpc);
@@ -761,8 +762,9 @@ SPIRVType *LLVMToSPIRVBase::transPointerType(SPIRVType *ET, unsigned AddrSpc) {
761
762
return transPointerType (ET, SPIRAS_Private);
762
763
if (BM->isAllowedToUseExtension (ExtensionID::SPV_KHR_untyped_pointers) &&
763
764
!(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 );
766
768
} else {
767
769
TranslatedTy = BM->addPointerType (
768
770
SPIRSPIRVAddrSpaceMap::map (static_cast <SPIRAddressSpace>(AddrSpc)), ET);
@@ -2347,10 +2349,8 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
2347
2349
}
2348
2350
SPIRVType *VarTy = TranslatedTy;
2349
2351
if (V->getType ()->getPointerAddressSpace () == SPIRAS_Generic) {
2350
- // TODO: refactor addPointerType and addUntypedPointerKHRType in one
2351
- // method if possible.
2352
2352
if (TranslatedTy->isTypeUntypedPointerKHR ())
2353
- VarTy = BM->addUntypedPointerKHRType (StorageClassFunction);
2353
+ VarTy = BM->addPointerType (StorageClassFunction, nullptr );
2354
2354
else
2355
2355
VarTy = BM->addPointerType (StorageClassFunction,
2356
2356
TranslatedTy->getPointerElementType ());
@@ -2697,11 +2697,8 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
2697
2697
SPIRVType *LLVMToSPIRVBase::mapType (Type *T, SPIRVType *BT) {
2698
2698
assert (!T->isPointerTy () && " Pointer types cannot be stored in the type map" );
2699
2699
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" );
2702
2701
SPIRVDBG (dbgs () << " [mapType] " << *T << " => " ; spvdbgs () << *BT << ' \n ' );
2703
- if (!EmplaceStatus.second )
2704
- return TypeMap[T];
2705
2702
return BT;
2706
2703
}
2707
2704
@@ -4302,8 +4299,8 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
4302
4299
SPIRVType *IntegralTy = transType (II->getType ()->getStructElementType (1 ));
4303
4300
// IntegralTy is the type of the result. We want to create a pointer to this
4304
4301
// 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 );
4307
4304
// We need to use the entry BB of the function calling llvm.modf.*, instead
4308
4305
// of the current BB. For that, we'll find current BB's parent and get its
4309
4306
// first BB, which is the entry BB of the function.
@@ -4829,7 +4826,7 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
4829
4826
auto *SrcTy = PtrOp->getType ();
4830
4827
SPIRVType *DstTy = nullptr ;
4831
4828
if (SrcTy->isTypeUntypedPointerKHR ())
4832
- DstTy = BM->addUntypedPointerKHRType (StorageClassFunction);
4829
+ DstTy = BM->addPointerType (StorageClassFunction, nullptr );
4833
4830
else
4834
4831
DstTy = BM->addPointerType (StorageClassFunction,
4835
4832
SrcTy->getPointerElementType ());
0 commit comments