================
@@ -2327,6 +2328,18 @@ CIRGenModule::getAddrOfConstantStringFromLiteral(const 
StringLiteral *s,
   return builder.getGlobalViewAttr(ptrTy, gv);
 }
 
+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))
+    return cir::TargetAddressSpaceAttr::get(
+        &getMLIRContext(), astContext.getTargetAddressSpace(as));
+  return cir::toCIRAddressSpaceAttr(getMLIRContext(), as);
----------------
aobolensk wrote:

That makes sense actually. I can prototype in in the next patch

https://github.com/llvm/llvm-project/pull/230813
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to