From cb97d6e9c4d96d821d3dde490c4fb01abe6a39d3 Mon Sep 17 00:00:00 2001 From: Alex Voicu Date: Tue, 26 Nov 2024 14:20:29 +0000 Subject: [PATCH] Casts to / from the constant AS to the generic AS are legal for AMDGCN. --- lib/SPIRV/SPIRVWriter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/SPIRV/SPIRVWriter.cpp b/lib/SPIRV/SPIRVWriter.cpp index a601849e..2769b3e9 100644 --- a/lib/SPIRV/SPIRVWriter.cpp +++ b/lib/SPIRV/SPIRVWriter.cpp @@ -1647,9 +1647,10 @@ SPIRVValue *LLVMToSPIRVBase::transUnaryInst(UnaryInstruction *U, SrcAddrSpace == SPIRAS_Generic, SPIRVEC_InvalidModule, U, "Casts from private/local/global address space are allowed only to " "generic\n"); - getErrorLog().checkError( - DestAddrSpace != SPIRAS_Constant, SPIRVEC_InvalidModule, U, - "Casts from generic address space to constant are illegal\n"); + if (M->getTargetTriple() != "spirv64-amd-amdhsa") + getErrorLog().checkError( + DestAddrSpace != SPIRAS_Constant, SPIRVEC_InvalidModule, U, + "Casts from generic address space to constant are illegal\n"); BOC = OpGenericCastToPtr; } } else {