[llvm] [DirectX backend] emits metadata for DXIL version. (PR #88350)

via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 09:42:47 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 080978dd2067d0c9ea7e229aa7696c2480d89ef1 6d0a795baaccf65dd2e94b4c94fff8c163509668 -- llvm/include/llvm/Transforms/Utils/DXIL.h llvm/lib/Transforms/Utils/DXIL.cpp llvm/lib/Target/DirectX/DXILTranslateMetadata.cpp llvm/lib/Transforms/Utils/DXILUpgrade.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/include/llvm/Transforms/Utils/DXIL.h b/llvm/include/llvm/Transforms/Utils/DXIL.h
index a91eeaa646..932077b929 100644
--- a/llvm/include/llvm/Transforms/Utils/DXIL.h
+++ b/llvm/include/llvm/Transforms/Utils/DXIL.h
@@ -63,4 +63,3 @@ inline raw_ostream &operator<<(raw_ostream &OS, const DXILVersion &V) {
 } // namespace llvm
 
 #endif // LLVM_TRANSFORMS_UTILS_DXIL_H
-
diff --git a/llvm/lib/Transforms/Utils/DXIL.cpp b/llvm/lib/Transforms/Utils/DXIL.cpp
index a87075fb4e..33c2ea3e5c 100644
--- a/llvm/lib/Transforms/Utils/DXIL.cpp
+++ b/llvm/lib/Transforms/Utils/DXIL.cpp
@@ -22,7 +22,7 @@ static Error errInvalid(const char *Msg) {
 }
 
 template <typename... Ts>
-static Error errInvalid(const char *Fmt, const Ts &... Vals) {
+static Error errInvalid(const char *Fmt, const Ts &...Vals) {
   return createStringError(std::errc::invalid_argument, Fmt, Vals...);
 }
 
@@ -34,26 +34,26 @@ Expected<DXILVersion> DXILVersion::get(Module &M) {
                       TT.getArchName().str().c_str());
 
   switch (TT.getSubArch()) {
-    case Triple::NoSubArch:
-    case Triple::DXILSubArch_v1_0:
-      return DXILVersion(1, 0);
-    case Triple::DXILSubArch_v1_1:
-      return DXILVersion(1, 1);
-    case Triple::DXILSubArch_v1_2:
-      return DXILVersion(1, 2);
-    case Triple::DXILSubArch_v1_3:
-      return DXILVersion(1, 3);
-    case Triple::DXILSubArch_v1_4:
-      return DXILVersion(1, 4);
-    case Triple::DXILSubArch_v1_5:
-      return DXILVersion(1, 5);
-    case Triple::DXILSubArch_v1_6:
-      return DXILVersion(1, 6);
-    case Triple::DXILSubArch_v1_7:
-      return DXILVersion(1, 7);
-    case Triple::DXILSubArch_v1_8:
-      return DXILVersion(1, 8);
-    default:
+  case Triple::NoSubArch:
+  case Triple::DXILSubArch_v1_0:
+    return DXILVersion(1, 0);
+  case Triple::DXILSubArch_v1_1:
+    return DXILVersion(1, 1);
+  case Triple::DXILSubArch_v1_2:
+    return DXILVersion(1, 2);
+  case Triple::DXILSubArch_v1_3:
+    return DXILVersion(1, 3);
+  case Triple::DXILSubArch_v1_4:
+    return DXILVersion(1, 4);
+  case Triple::DXILSubArch_v1_5:
+    return DXILVersion(1, 5);
+  case Triple::DXILSubArch_v1_6:
+    return DXILVersion(1, 6);
+  case Triple::DXILSubArch_v1_7:
+    return DXILVersion(1, 7);
+  case Triple::DXILSubArch_v1_8:
+    return DXILVersion(1, 8);
+  default:
     return errInvalid("Cannot get DXIL version for arch '%s'",
                       TT.getArchName().str().c_str());
   }
@@ -82,9 +82,7 @@ Expected<DXILVersion> DXILVersion::readDXIL(Module &M) {
   return DXILVersion(MajorOp->getZExtValue(), MinorOp->getZExtValue());
 }
 
-void DXILVersion::strip(Module &M) {
-  M.setTargetTriple("dxil-ms-dx");
-}
+void DXILVersion::strip(Module &M) { M.setTargetTriple("dxil-ms-dx"); }
 
 void DXILVersion::embed(Module &M) {
   Triple TT(Triple::normalize(M.getTargetTriple()));

``````````

</details>


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


More information about the llvm-commits mailing list