[llvm] [SPIRV] Change how to detect OpenCL/Vulkan Env and update tests accordingly. (PR #129689)
Marcos Maronas via llvm-commits
llvm-commits at lists.llvm.org
Tue May 27 08:36:34 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())
----------------
maarquitos14 wrote:
Note that `!isShaderEnv()` is not exactly the same as `isKernelEnv()`. There are phases where the environment is `Unknown`, until we find anything in the module that allows as to definitely infer the correct environment. Thus, `!isShaderEnv()` is true when `Env == Unknown` or `Env == Kernel`, but `isKernelEnv()` is only true when `Env == Kernel`, but not when `Env == Unknown`. Again, that would break the current behavior for triples like `spirv[32|64]-unknown-unknown`.
This applies to all the other suggestions as well.
https://github.com/llvm/llvm-project/pull/129689
More information about the llvm-commits
mailing list