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

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 10 04:28:41 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())
----------------
arsenm wrote:

This is still special casing an address space. The specific language address space should not be visible at the codegen points

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


More information about the cfe-commits mailing list