[clang] [llvm] [DirectX][DXIL] Set DXIL Version in DXIL target triple based on shader model version (PR #90809)

via cfe-commits cfe-commits at lists.llvm.org
Mon May 6 14:36:26 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 94204f59e92473bb19333f40a2250b64a398191a e739a33712f15e0d1fe1d9a121a564418a449437 -- clang/lib/Basic/Targets.cpp clang/lib/Driver/ToolChains/HLSL.cpp clang/test/CodeGenHLSL/basic-target.c clang/unittests/Driver/DXCModeTest.cpp llvm/include/llvm/TargetParser/Triple.h llvm/lib/IR/Verifier.cpp llvm/lib/TargetParser/Triple.cpp llvm/unittests/TargetParser/TripleTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
index 59a2cfd4eb..a6989790a9 100644
--- a/llvm/lib/TargetParser/Triple.cpp
+++ b/llvm/lib/TargetParser/Triple.cpp
@@ -1244,10 +1244,12 @@ std::string Triple::normalize(StringRef Str) {
     }
     // Add DXIL version only if shadermodel is specified in the triple
     if (OS == Triple::ShaderModel) {
-      VersionTuple Ver = parseVersionFromName(Components[2].drop_front(strlen("shadermodel")));
-      // Default DXIL minor version when Shader Model version is anything other than
-      // 6.[0...8] or 6.x (which translates to latest current SM version)
-      // DXIL version corresponding to Shader Model version other than 6.x is 1.0
+      VersionTuple Ver =
+          parseVersionFromName(Components[2].drop_front(strlen("shadermodel")));
+      // Default DXIL minor version when Shader Model version is anything other
+      // than 6.[0...8] or 6.x (which translates to latest current SM version)
+      // DXIL version corresponding to Shader Model version other than 6.x
+      // is 1.0
       unsigned DXILMinor = 0;
       const unsigned SMMajor = 6;
       const unsigned LatestCurrentDXILMinor = 8;
diff --git a/llvm/unittests/TargetParser/TripleTest.cpp b/llvm/unittests/TargetParser/TripleTest.cpp
index 025e3faa4b..3112014d9e 100644
--- a/llvm/unittests/TargetParser/TripleTest.cpp
+++ b/llvm/unittests/TargetParser/TripleTest.cpp
@@ -2467,6 +2467,7 @@ TEST(TripleTest, DXILNormaizeWithVersion) {
   EXPECT_EQ("dxilv1.8-unknown-shadermodel6.x-unknown",
             Triple::normalize("dxil-unknown-shadermodel6.x-unknown"));
   EXPECT_EQ("dxil-unknown-unknown-unknown", Triple::normalize("dxil---"));
-  EXPECT_EQ("dxilv1.0-pc-shadermodel5.0-compute", Triple::normalize("dxil-shadermodel5.0-pc-compute"));
+  EXPECT_EQ("dxilv1.0-pc-shadermodel5.0-compute",
+            Triple::normalize("dxil-shadermodel5.0-pc-compute"));
 }
 } // end anonymous namespace

``````````

</details>


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


More information about the cfe-commits mailing list