[clang] Add spirv-val compilation step when targeting SPIR-V (PR #188150)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 06:53:40 PDT 2026


================
@@ -4745,7 +4705,8 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
     }
   }
 
-  if (C.getDefaultToolChain().getTriple().isDXIL()) {
+  if (C.getDefaultToolChain().getTriple().isDXIL() ||
+      C.getDefaultToolChain().getTriple().isSPIRV()) {
     const auto &TC =
         static_cast<const toolchains::HLSLToolChain &>(C.getDefaultToolChain());
----------------
bogner wrote:

I don't think checking `isSPIRV` is correct here. If the triple is a non-vulkan SPIRV target, we would have a SPIRVToolChain, and the static cast here is UB. Technically `isDXIL` doesn't really guarantee the toolchain here either though that probably can't come up in practice. I guess the simplest way to make this code "correct" would be to check the `getOS()` is either `Vulkan` or `ShaderModel`.

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


More information about the cfe-commits mailing list