diff --git a/lib/SPIRV/SPIRVReader.cpp b/lib/SPIRV/SPIRVReader.cpp index cc6219ce..9d8b0fff 100644 --- a/lib/SPIRV/SPIRVReader.cpp +++ b/lib/SPIRV/SPIRVReader.cpp @@ -3552,8 +3552,11 @@ Instruction *SPIRVToLLVM::transBuiltinFromInst(const std::string &FuncName, auto *AI = static_cast(BI); ArgTys[Ptr] = TypedPointerType::get( transType(AI->getSemanticType()), - SPIRSPIRVAddrSpaceMap::rmap( - BI->getValueType(Ops[Ptr]->getId())->getPointerStorageClass())); + M->getTargetTriple() == "amdgcn-amd-amdhsa" + ? mapSPIRVAddrSpaceToAMDGPU( + BI->getValueType(Ops[Ptr]->getId())->getPointerStorageClass()) + : SPIRSPIRVAddrSpaceMap::rmap( + BI->getValueType(Ops[Ptr]->getId())->getPointerStorageClass())); } } @@ -5359,7 +5362,9 @@ Instruction *SPIRVToLLVM::transOCLBuiltinFromExtInst(SPIRVExtInst *BC, auto *BVar = static_cast(BC->getArgValue(I)); ArgTypes[I] = TypedPointerType::get( transType(BVar->getDataType()), - SPIRSPIRVAddrSpaceMap::rmap(BVar->getStorageClass())); + (M->getTargetTriple() == "amdgcn-amd-amdhsa") + ? mapSPIRVAddrSpaceToAMDGPU(BVar->getStorageClass()) + : SPIRSPIRVAddrSpaceMap::rmap(BVar->getStorageClass())); } }