[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:32:00 PDT 2025
    
    
  
================
@@ -83,6 +83,14 @@ SPIRVSubtarget::SPIRVSubtarget(const Triple &TT, const std::string &CPU,
   }
   OpenCLVersion = VersionTuple(2, 2);
 
+  // Set the environment based on the target triple.
+  if (TargetTriple.getOS() == Triple::Vulkan)
+    Env = Shader;
+  else if (TargetTriple.getEnvironment() == Triple::OpenCL)
+    Env = Kernel;
+  else
+    Env = Unknown;
----------------
Keenuts wrote:
Yes, noticed this later on, I think the other location with the asserts would be better.
https://github.com/llvm/llvm-project/pull/129689
    
    
More information about the llvm-commits
mailing list