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

Keshav Vinayak Jha via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 15 00:46:46 PDT 2026


================
@@ -2248,6 +2248,9 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile,
       Addr.withElementType(convertTypeForLoadStore(Ty, Addr.getElementType()));
 
   llvm::LoadInst *Load = Builder.CreateLoad(Addr, Volatile);
+  if (Ty.getAddressSpace() == LangAS::opencl_constant || BaseInfo.isInvariant())
----------------
keshavvinayak01 wrote:

I've moved it around, but I see usage in https://github.com/llvm/llvm-project/blob/0db5329758ea658bb5580408560c6333ed815bbb/clang/lib/CodeGen/CGDebugInfo.cpp#L6317 as well.

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


More information about the cfe-commits mailing list