[clang] 9f6cd56 - [HLSL] Use HLSLToolChain for Vulkan (#110306)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 30 07:26:17 PDT 2024
Author: Steven Perron
Date: 2024-09-30T10:26:14-04:00
New Revision: 9f6cd56d5a366d1b75a62a207b6568d362ea82d5
URL: https://github.com/llvm/llvm-project/commit/9f6cd56d5a366d1b75a62a207b6568d362ea82d5
DIFF: https://github.com/llvm/llvm-project/commit/9f6cd56d5a366d1b75a62a207b6568d362ea82d5.diff
LOG: [HLSL] Use HLSLToolChain for Vulkan (#110306)
The options are not translated correctly when targeting Vulkan using the
dxc
driver mode. Resuing the translator used for HLSL.
Fixes problem 2 in https://github.com/llvm/llvm-project/issues/108567.
Added:
Modified:
clang/lib/Driver/Driver.cpp
clang/test/CodeGenHLSL/entry.hlsl
clang/test/Driver/dxc_E.hlsl
Removed:
################################################################################
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index d0c8bdba0ede95..fba6a8853c3960 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -6481,6 +6481,7 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
case llvm::Triple::ZOS:
TC = std::make_unique<toolchains::ZOS>(*this, Target, Args);
break;
+ case llvm::Triple::Vulkan:
case llvm::Triple::ShaderModel:
TC = std::make_unique<toolchains::HLSLToolChain>(*this, Target, Args);
break;
diff --git a/clang/test/CodeGenHLSL/entry.hlsl b/clang/test/CodeGenHLSL/entry.hlsl
index ec4254e76fb66b..cd3bf948df48c4 100644
--- a/clang/test/CodeGenHLSL/entry.hlsl
+++ b/clang/test/CodeGenHLSL/entry.hlsl
@@ -2,6 +2,10 @@
// RUN: dxil-pc-shadermodel6.3-compute %s -hlsl-entry foo \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
+// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \
+// RUN: spirv-unknown-vulkan-compute %s -hlsl-entry foo \
+// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s
+
// Make sure not mangle entry.
// CHECK:define void @foo()
// Make sure add function attribute and numthreads attribute.
diff --git a/clang/test/Driver/dxc_E.hlsl b/clang/test/Driver/dxc_E.hlsl
index 05cfca685c9a65..07715a2e2259af 100644
--- a/clang/test/Driver/dxc_E.hlsl
+++ b/clang/test/Driver/dxc_E.hlsl
@@ -1,4 +1,5 @@
// RUN: not %clang_dxc -Efoo -Tlib_6_7 foo.hlsl -### %s 2>&1 | FileCheck %s
+// RUN: not %clang_dxc -Efoo -Tlib_6_7 -spirv foo.hlsl -### %s 2>&1 | FileCheck %s
// Make sure E option flag which translated into "-hlsl-entry".
// CHECK:"-hlsl-entry" "foo"
More information about the cfe-commits
mailing list