[clang] [CIR][SPIR-V] Move global address space selection to a target hook (PR #231098)

Arseniy Obolenskiy via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 12 07:58:03 PDT 2026


================
@@ -2330,14 +2330,7 @@ CIRGenModule::getAddrOfConstantStringFromLiteral(const StringLiteral *s,
 
 mlir::ptr::MemorySpaceAttrInterface
 CIRGenModule::getGlobalCIRAddressSpace(LangAS as) {
-  // The cir::LangAddressSpace fold loses the SPIRDefIsGenMap split between
-  // cuda_constant and opencl_constant, so use the target map like classic.
-  if (langOpts.CUDAIsDevice && getTriple().isSPIRV() &&
-      (as == LangAS::cuda_device || as == LangAS::cuda_constant ||
-       as == LangAS::cuda_shared))
----------------
aobolensk wrote:

Yes, `cuda_*` AS only can come from getGlobalVarAddressSpace under CUDA && CUDAIsDevice, so the check is redundant once the logic moved into the SPIR target hook

https://github.com/llvm/llvm-project/pull/231098


More information about the cfe-commits mailing list