[clang] [OpenCL] Put constant initializer globals into constant addrspace (PR #90048)
Sven van Haastregt via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 26 05:54:28 PDT 2024
================
@@ -536,6 +536,8 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType,
CodeGen::CodeGenModule &CGM = CGF.CGM;
ConstantEmitter Emitter(CGF);
LangAS AS = ArrayQTy.getAddressSpace();
+ if (CGF.getLangOpts().OpenCL)
+ AS = LangAS::opencl_constant;
----------------
svenvh wrote:
The OpenCL language defines the constant address space for read-only variables. Targets can decide for themselves how to map the language address space to a target address space (which is done further down at the GlobalVariable creation).
https://github.com/llvm/llvm-project/pull/90048
More information about the cfe-commits
mailing list