[llvm] [SPIRV] Change how to detect OpenCL/Vulkan Env and update tests accordingly. (PR #129689)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Tue May 27 08:46:33 PDT 2025


================
@@ -767,10 +767,10 @@ Register SPIRVGlobalRegistry::buildGlobalVariable(
   // TODO: maybe move to GenerateDecorations pass.
   const SPIRVSubtarget &ST =
       cast<SPIRVSubtarget>(MIRBuilder.getMF().getSubtarget());
-  if (IsConst && ST.isOpenCLEnv())
+  if (IsConst && !ST.isShaderEnv())
----------------
Keenuts wrote:

This is a bit of an issue: Alignment decoration for ex required the Kernel capability. If we add this at some point because we are still 'Unknown', and then find a reason to switch to `Shader`, then we have a bad module.
We should definitely infer the env before doing this codegen then.

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


More information about the llvm-commits mailing list