[clang] [HLSL] update default validator version to 1.8. (PR #104040)

Xiang Li via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 08:32:20 PDT 2024


https://github.com/python3kgae created https://github.com/llvm/llvm-project/pull/104040

Change default validator version to 1.8 in Options.td. 
Remove the default value set in HLSL.cpp.

This is for #99910.

>From 56511b7d2d565bbf974b665491cee47c0be9a2bc Mon Sep 17 00:00:00 2001
From: Xiang Li <python3kgae at outlook.com>
Date: Wed, 14 Aug 2024 11:21:33 -0400
Subject: [PATCH] [HLSL] change default validator version to 1.8.

Change default validator version to 1.8 in Options.td.
Remove the default value set in HLSL.cpp.

This is for #99910.
---
 clang/include/clang/Driver/Options.td                 |  2 +-
 clang/lib/Driver/ToolChains/HLSL.cpp                  |  8 --------
 clang/test/CodeGenHLSL/default_validator_version.hlsl | 10 ++++++++++
 3 files changed, 11 insertions(+), 9 deletions(-)
 create mode 100644 clang/test/CodeGenHLSL/default_validator_version.hlsl

diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 6df3a6a5943a97..1cd6dcf5091c23 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -8836,7 +8836,7 @@ def dxil_validator_version : Option<["/", "-"], "validator-version", KIND_SEPARA
   Visibility<[DXCOption, ClangOption, CC1Option]>,
   HelpText<"Override validator version for module. Format: <major.minor>;"
            "Default: DXIL.dll version or current internal version">,
-  MarshallingInfoString<TargetOpts<"DxilValidatorVersion">>;
+  MarshallingInfoString<TargetOpts<"DxilValidatorVersion">, "\"1.8\"">;
 def target_profile : DXCJoinedOrSeparate<"T">, MetaVarName<"<profile>">,
   HelpText<"Set target profile">,
   Values<"ps_6_0, ps_6_1, ps_6_2, ps_6_3, ps_6_4, ps_6_5, ps_6_6, ps_6_7,"
diff --git a/clang/lib/Driver/ToolChains/HLSL.cpp b/clang/lib/Driver/ToolChains/HLSL.cpp
index 8286e3be21803f..ad44c2cfcd8115 100644
--- a/clang/lib/Driver/ToolChains/HLSL.cpp
+++ b/clang/lib/Driver/ToolChains/HLSL.cpp
@@ -283,14 +283,6 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
     DAL->append(A);
   }
 
-  // Add default validator version if not set.
-  // TODO: remove this once read validator version from validator.
-  if (!DAL->hasArg(options::OPT_dxil_validator_version)) {
-    const StringRef DefaultValidatorVer = "1.7";
-    DAL->AddSeparateArg(nullptr,
-                        Opts.getOption(options::OPT_dxil_validator_version),
-                        DefaultValidatorVer);
-  }
   if (!DAL->hasArg(options::OPT_O_Group)) {
     DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_O), "3");
   }
diff --git a/clang/test/CodeGenHLSL/default_validator_version.hlsl b/clang/test/CodeGenHLSL/default_validator_version.hlsl
new file mode 100644
index 00000000000000..907526dd685a96
--- /dev/null
+++ b/clang/test/CodeGenHLSL/default_validator_version.hlsl
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -emit-llvm -xhlsl -o - %s | FileCheck %s
+
+// CHECK:!dx.valver = !{![[valver:[0-9]+]]}
+// CHECK:![[valver]] = !{i32 1, i32 8}
+
+float bar(float a, float b);
+
+float foo(float a, float b) {
+  return bar(a, b);
+}



More information about the cfe-commits mailing list