[clang] [Clang][OpenCL] Mark scalar loads from constant address space invariant (PR #218356)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 6 14:05:10 PST 2026


================
@@ -6355,6 +6355,14 @@ LangAS CodeGenModule::GetGlobalVarAddressSpace(const VarDecl *D) {
   return getTargetCodeGenInfo().getGlobalVarAddressSpace(*this, D);
 }
 
+bool CodeGenModule::isGlobalVarInvariant(const VarDecl *D) {
+  // Only OpenCL and CUDA device globals are handled here. On other targets,
----------------
arsenm wrote:

The language attributes should also have consistent semantics regardless of the language mode. e.g. opencl_constant should behave the same even if the language is not OpenCL 

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


More information about the cfe-commits mailing list