[llvm] 724ad11 - [DirectX] Add `--dx-embed-debug` and `--dx-pdb-path` flags (#204166)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 04:29:18 PDT 2026


Author: Ilia Kuklin
Date: 2026-07-09T16:29:13+05:00
New Revision: 724ad1150d5d38c96ac9d848ea21cad165415bd7

URL: https://github.com/llvm/llvm-project/commit/724ad1150d5d38c96ac9d848ea21cad165415bd7
DIFF: https://github.com/llvm/llvm-project/commit/724ad1150d5d38c96ac9d848ea21cad165415bd7.diff

LOG: [DirectX] Add `--dx-embed-debug` and `--dx-pdb-path` flags (#204166)

Add flags for DirectX in `llc`:
* `--dx-embed-debug` to embed debug info into ILDB part of DXContainer
* `--dx-pdb-path` to specify filename/path for PDB file output

This patch does not add flags for clang Driver, they will be implemented
later.

Added: 
    llvm/test/CodeGen/DirectX/ContainerData/ContainerFlags.ll
    llvm/test/CodeGen/DirectX/ContainerData/DebugName-user-specified.test
    llvm/test/CodeGen/DirectX/ContainerData/DebugName.test

Modified: 
    llvm/include/llvm/MC/MCDXContainerWriter.h
    llvm/lib/MC/MCDXContainerWriter.cpp
    llvm/lib/Target/DirectX/DXContainerGlobals.cpp
    llvm/lib/Target/DirectX/DXContainerPDB.cpp
    llvm/lib/Target/DirectX/DXILWriter/DXILWriterPass.cpp
    llvm/test/CodeGen/DirectX/ContainerData/DebugName-default-output.test
    llvm/test/CodeGen/DirectX/ContainerData/DebugName-user-directory.test
    llvm/test/CodeGen/DirectX/ContainerData/PDBParts.test
    llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Args.ll
    llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Compressed.ll
    llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Uncompressed.ll
    llvm/test/CodeGen/DirectX/embed-ildb.ll

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCDXContainerWriter.h b/llvm/include/llvm/MC/MCDXContainerWriter.h
index 8bc6d31eb25d0..1df38b6ff906b 100644
--- a/llvm/include/llvm/MC/MCDXContainerWriter.h
+++ b/llvm/include/llvm/MC/MCDXContainerWriter.h
@@ -73,6 +73,7 @@ class LLVM_ABI DXContainerObjectWriter final : public MCDXContainerBaseWriter,
 
 protected:
   ArrayRef<MCDXContainerPart> collectParts() override;
+  bool shouldSkipSection(StringRef SectionName, size_t SectionSize) override;
 
 public:
   DXContainerObjectWriter(std::unique_ptr<MCDXContainerTargetWriter> MOTW,

diff  --git a/llvm/lib/MC/MCDXContainerWriter.cpp b/llvm/lib/MC/MCDXContainerWriter.cpp
index de973f2667da3..994b90fbcb66b 100644
--- a/llvm/lib/MC/MCDXContainerWriter.cpp
+++ b/llvm/lib/MC/MCDXContainerWriter.cpp
@@ -13,9 +13,13 @@
 #include "llvm/MC/MCSection.h"
 #include "llvm/MC/MCValue.h"
 #include "llvm/Support/Alignment.h"
+#include "llvm/Support/CommandLine.h"
 
 using namespace llvm;
 
+cl::opt<bool> EmbedDebug("dx-embed-debug",
+                         cl::desc("Embed PDB in shader container"));
+
 MCDXContainerTargetWriter::~MCDXContainerTargetWriter() = default;
 
 MCDXContainerBaseWriter::~MCDXContainerBaseWriter() = default;
@@ -132,6 +136,16 @@ ArrayRef<MCDXContainerPart> DXContainerObjectWriter::collectParts() {
   return Parts;
 }
 
+bool DXContainerObjectWriter::shouldSkipSection(StringRef SectionName,
+                                                size_t SectionSize) {
+  // Do not write ILDB part if we're not embedding it.
+  if (!EmbedDebug && SectionName == "ILDB")
+    return true;
+  if (SectionName == "SRCI")
+    return true;
+  return MCDXContainerBaseWriter::shouldSkipSection(SectionName, SectionSize);
+}
+
 uint64_t DXContainerObjectWriter::writeObject() {
   write(W.OS, getContext().getTargetTriple());
   clearParts();

diff  --git a/llvm/lib/Target/DirectX/DXContainerGlobals.cpp b/llvm/lib/Target/DirectX/DXContainerGlobals.cpp
index 4451d46130c45..47396b8c33580 100644
--- a/llvm/lib/Target/DirectX/DXContainerGlobals.cpp
+++ b/llvm/lib/Target/DirectX/DXContainerGlobals.cpp
@@ -41,15 +41,11 @@ using namespace llvm::mcdxbc;
 
 static cl::opt<bool> ShaderHashDependsOnSource(
     "dx-Zss", cl::desc("Compute Shader Hash considering source information"));
-static cl::opt<std::string>
-    PdbFileName("dx-pdb-file",
-                cl::desc("Specify the PDB output file path for DirectX target"),
-                cl::value_desc("filename"));
-static cl::opt<std::string> PdbOutputDir(
-    "dx-pdb-dir",
-    cl::desc("Specify the PDB output directory for DirectX target. The file "
-             "name is derived from the shader hash"),
-    cl::value_desc("directory"));
+cl::opt<std::string> PdbDebugPath(
+    "dx-pdb-path",
+    cl::desc("Write debug information to the given file, or automatically "
+             "named file in directory when ending in '/'"),
+    cl::value_desc("filename"));
 
 namespace {
 class DXContainerGlobals : public llvm::ModulePass {
@@ -148,9 +144,9 @@ void DXContainerGlobals::computeShaderHashAndDebugName(
   }
 
   Digest.update(DXILConstant->getRawDataValues());
-  MD5::MD5Result Result = Digest.final();
+  MD5::MD5Result MD5 = Digest.final();
 
-  memcpy(reinterpret_cast<void *>(&HashData.Digest), Result.data(), 16);
+  memcpy(reinterpret_cast<void *>(&HashData.Digest), MD5.data(), 16);
   if (sys::IsBigEndianHost)
     HashData.swapBytes();
   StringRef Data(reinterpret_cast<char *>(&HashData), sizeof(dxbc::ShaderHash));
@@ -160,47 +156,41 @@ void DXContainerGlobals::computeShaderHashAndDebugName(
   Globals.emplace_back(
       buildContainerGlobal(M, ModuleConstant, "dx.hash", "HASH"));
 
-  // Emit ILDN part in debug info mode.
-  // DXIL bitcode hash is used, which corresponds to DXC behavior with
-  // `/Zi /Qembed_debug /Zsb` flags.
   if (M.debug_compile_units().empty())
     return;
 
-  if (!PdbFileName.empty() && !PdbOutputDir.empty())
-    report_fatal_error(
-        "--dx-pdb-file and --dx-pdb-dir are mutually exclusive options");
-
   SmallString<40> DebugNameStr;
-  Digest.stringifyResult(Result, DebugNameStr);
+  Digest.stringifyResult(MD5, DebugNameStr);
   DebugNameStr += ".pdb";
+  if (!PdbDebugPath.empty()) {
+    StringRef DebugFile = PdbDebugPath.getValue();
+    SmallString<256> AbsoluteDebugName;
+    if (sys::path::is_separator(DebugFile.back())) {
+      // If /Fd was specified as a directory, put the MD5.pdb file there.
+      AbsoluteDebugName = DebugFile;
+      sys::path::append(AbsoluteDebugName, DebugNameStr);
+    } else {
+      // Otherwise, use /Fd value as a user-provided PDB file name.
+      DebugNameStr = DebugFile;
+      AbsoluteDebugName = DebugNameStr;
+    }
 
-  mcdxbc::DebugName DebugName;
-  if (PdbFileName.empty()) {
-    // Use the MD5 hash as the file name.
-    Digest.stringifyResult(Result, DebugNameStr);
-    DebugNameStr += ".pdb";
-  } else {
-    // Use user-provided PDB file name.
-    DebugNameStr = PdbFileName;
+    // Pass PDB name to DXContainerPDBPass via PDBNAME section.
+    addSection(M, Globals, AbsoluteDebugName, "dx.pdb.name",
+               PdbFileNameSectionName);
+    // Pass module hash to DXContainerPDBPass.
+    Globals.emplace_back(buildContainerGlobal(
+        M, ConstantDataArray::get(M.getContext(), ArrayRef(HashData.Digest)),
+        "dx.pdb.hash", ModuleHashSectionName));
   }
-  DebugName.setFilename(DebugNameStr);
-
-  SmallString<256> AbsoluteDebugName(PdbOutputDir);
-  sys::path::append(AbsoluteDebugName, DebugNameStr);
 
+  // Emit ILDN part in debug info mode.
+  mcdxbc::DebugName DebugName;
+  DebugName.setFilename(DebugNameStr);
   SmallString<64> ILDNData;
   raw_svector_ostream OS(ILDNData);
   DebugName.write(OS);
   addSection(M, Globals, ILDNData, "dx.ildn", "ILDN");
-
-  // TODO: Do not create PDB in embedded mode.
-  // Pass PDB name to DXContainerPDBPass via PDBNAME section.
-  addSection(M, Globals, AbsoluteDebugName, "dx.pdb.name",
-             PdbFileNameSectionName);
-  // Pass module hash to DXContainerPDBPass.
-  Globals.emplace_back(buildContainerGlobal(
-      M, ConstantDataArray::get(M.getContext(), ArrayRef(HashData.Digest)),
-      "dx.pdb.hash", ModuleHashSectionName));
 }
 
 GlobalVariable *DXContainerGlobals::buildContainerGlobal(

diff  --git a/llvm/lib/Target/DirectX/DXContainerPDB.cpp b/llvm/lib/Target/DirectX/DXContainerPDB.cpp
index 96d6af03fe4ea..dc3c05376b2c1 100644
--- a/llvm/lib/Target/DirectX/DXContainerPDB.cpp
+++ b/llvm/lib/Target/DirectX/DXContainerPDB.cpp
@@ -148,7 +148,8 @@ bool DXContainerPDB::runOnModule(Module &M) {
   auto BypassSandbox = sys::sandbox::scopedDisable();
   codeview::GUID IgnoredOutGuid;
   if (Error Err = Builder.commit(DebugFileName, &IgnoredOutGuid))
-    reportFatalUsageError(std::move(Err));
+    reportFatalUsageError("Couldn't write to PDB file: " +
+                          Twine(toString(std::move(Err))));
 
   reset();
 

diff  --git a/llvm/lib/Target/DirectX/DXILWriter/DXILWriterPass.cpp b/llvm/lib/Target/DirectX/DXILWriter/DXILWriterPass.cpp
index e78e6775403fa..9bbb87327d749 100644
--- a/llvm/lib/Target/DirectX/DXILWriter/DXILWriterPass.cpp
+++ b/llvm/lib/Target/DirectX/DXILWriter/DXILWriterPass.cpp
@@ -35,6 +35,9 @@
 using namespace llvm;
 using namespace llvm::dxil;
 
+extern cl::opt<bool> EmbedDebug;
+extern cl::opt<std::string> PdbDebugPath;
+
 namespace {
 class WriteDXILPass : public llvm::ModulePass {
   raw_ostream &OS; // raw_ostream to print on
@@ -227,6 +230,18 @@ class EmbedDXILPass : public llvm::ModulePass {
     legalizeLifetimeIntrinsics(M);
 
     bool HasDebugInfo = !M.debug_compile_units().empty();
+
+    // Enable EmbedDebug if there is debug info, but it is not being written
+    // to a PDB file.
+    if (HasDebugInfo && !EmbedDebug && PdbDebugPath.empty())
+      EmbedDebug = true;
+    if (!HasDebugInfo && EmbedDebug)
+      reportFatalUsageError(
+          "Missing debug info for embedding into the container");
+    // TODO: move this check to DXContainerPDB.cpp when /Zs is implemented.
+    if (!HasDebugInfo && !PdbDebugPath.empty())
+      reportFatalUsageError("Missing debug info for writing to the PDB file");
+
     std::string ILDBData;
     if (HasDebugInfo) {
       // Write DXIL with debug info to ILDB part.

diff  --git a/llvm/test/CodeGen/DirectX/ContainerData/ContainerFlags.ll b/llvm/test/CodeGen/DirectX/ContainerData/ContainerFlags.ll
new file mode 100644
index 0000000000000..1d14c32e58fae
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/ContainerData/ContainerFlags.ll
@@ -0,0 +1,38 @@
+;; Check that --dx-embed-debug is enabled by default when debug info is present
+; RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj -o %t.cso
+; RUN: obj2yaml %t.cso | FileCheck %s --check-prefix=DEFAULT-EMBED
+; DEFAULT-EMBED: Parts:
+; DEFAULT-EMBED:   - Name:            ILDB
+; DEFAULT-EMBED:   - Name:            ILDN
+
+;; Check that debug info is not embedded if only the PDB ouput is specified
+; RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj --dx-pdb-path=%t.pdb -o %t.cso
+; RUN: obj2yaml %t.cso | FileCheck %s --check-prefix=NO-EMBED
+; NO-EMBED: Parts:
+; NO-EMBED-NOT:   - Name:            ILDB
+; NO-EMBED:       - Name:            ILDN
+
+;; Check that debug info is both embedded and output to the PDB
+;; if both options are specified
+; RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj --dx-embed-debug --dx-pdb-path=%t.pdb -o %t.cso
+; RUN: obj2yaml %t.cso | FileCheck %s --check-prefix=EMBED
+; EMBED: Parts:
+; EMBED:   - Name:            ILDB
+; EMBED:   - Name:            ILDN
+; RUN: llvm-pdbutil pdb2yaml --dxcontainer %t.pdb | FileCheck %s --check-prefix=PDB
+; Check that PDB file contains only debug-info relevant parts.
+; PDB:     Parts:
+; PDB-DAG:   - Name:            ILDB
+; PDB-DAG:   - Name:            ILDN
+
+;; Check errors when trying to output debug info with no debug info present
+; RUN: not llc %s --filetype=obj --dx-embed-debug -o %t.cso 2>&1 | FileCheck %s --check-prefix=ERROR-NODBG
+; ERROR-NODBG: Missing debug info for embedding into the container
+; RUN: not llc %s --filetype=obj --dx-pdb-path=%t.pdb -o %t.cso 2>&1 | FileCheck %s --check-prefix=ERROR-NODBG-PDB
+; ERROR-NODBG-PDB: Missing debug info for writing to the PDB file
+
+target triple = "dxil-unknown-shadermodel6.5-library"
+
+define i32 @foo(i32 %a) {
+  ret i32 %a
+}

diff  --git a/llvm/test/CodeGen/DirectX/ContainerData/DebugName-default-output.test b/llvm/test/CodeGen/DirectX/ContainerData/DebugName-default-output.test
index 3914a3250df7d..abaee2ac5b3b3 100644
--- a/llvm/test/CodeGen/DirectX/ContainerData/DebugName-default-output.test
+++ b/llvm/test/CodeGen/DirectX/ContainerData/DebugName-default-output.test
@@ -3,7 +3,6 @@ RUN: llvm-objcopy --dump-section=DXIL=%t0.bc %t.dxbc
 RUN: %md5sum %t0.bc >%t0.bc.md5
 RUN: obj2yaml %t.dxbc >%t.yaml
 RUN: cat %t.yaml %t0.bc.md5 | FileCheck %s
-RUN: %python %S/Inputs/check_pdb_exists.py "" "%t0.bc.md5"
 
 CHECK-NOT:   - Name:            PDBN
 CHECK-NOT:   - Name:            PDBH

diff  --git a/llvm/test/CodeGen/DirectX/ContainerData/DebugName-user-directory.test b/llvm/test/CodeGen/DirectX/ContainerData/DebugName-user-directory.test
index 3a6fb6c0476f2..252b0b8a839b5 100644
--- a/llvm/test/CodeGen/DirectX/ContainerData/DebugName-user-directory.test
+++ b/llvm/test/CodeGen/DirectX/ContainerData/DebugName-user-directory.test
@@ -1,5 +1,5 @@
 RUN: rm -rf %t && mkdir %t
-RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj -o %t.dxbc --dx-pdb-dir=%t
+RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj -o %t.dxbc --dx-pdb-path=%t/
 RUN: llvm-objcopy --dump-section=DXIL=%t0.bc %t.dxbc
 RUN: %md5sum %t0.bc >%t0.bc.md5
 RUN: obj2yaml %t.dxbc >%t.yaml

diff  --git a/llvm/test/CodeGen/DirectX/ContainerData/DebugName-user-specified.test b/llvm/test/CodeGen/DirectX/ContainerData/DebugName-user-specified.test
new file mode 100644
index 0000000000000..724960dceb0ca
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/ContainerData/DebugName-user-specified.test
@@ -0,0 +1,9 @@
+RUN: rm -rf %t && mkdir %t
+RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj -o - --dx-pdb-path=%t/ofile.pdb | obj2yaml | FileCheck %s
+RUN: test -f %t/ofile.pdb
+
+CHECK:       - Name:            ILDN
+CHECK:         DebugName:
+CHECK-NEXT:      Flags:           0
+CHECK-NEXT:      NameLength:      {{.*}}
+CHECK-NEXT:      DebugName:       {{.*[/\]+}}ofile.pdb

diff  --git a/llvm/test/CodeGen/DirectX/ContainerData/DebugName.test b/llvm/test/CodeGen/DirectX/ContainerData/DebugName.test
new file mode 100644
index 0000000000000..e3427e2d77848
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/ContainerData/DebugName.test
@@ -0,0 +1,22 @@
+# Check that debug name and hashed are passed to DXContainerPDBPass, but
+# not emitted into output file (checked with --implicit-check-not arguments).
+RUN: opt %S/Inputs/SourceInfo.ll -dxil-embed -dxil-globals --dx-pdb-path=%t.pdb -S -o - \
+RUN:   | FileCheck %s --check-prefix=BC
+BC:          @dx.pdb.name
+BC:          @dx.pdb.hash
+
+# Check that ILDN debug name is calculated from DXIL by default.
+RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj -o %t.dxbc
+RUN: llvm-objcopy --dump-section=DXIL=%t0.bc %t.dxbc
+RUN: %md5sum %t0.bc >%t0.bc.md5
+RUN: obj2yaml %t.dxbc >%t.yaml
+RUN: cat %t.yaml %t0.bc.md5 | FileCheck %s --implicit-check-not PDBN --implicit-check-not PDBH
+
+CHECK:       - Name:            ILDN
+CHECK-NEXT:    Size:            44
+CHECK-NEXT:    DebugName:
+CHECK-NEXT:      Flags:           0
+CHECK-NEXT:      NameLength:      36
+CHECK-NEXT:      DebugName:       [[MD5:[0-9a-f]+]].pdb
+CHECK:       ...
+CHECK-NEXT:  [[MD5]]

diff  --git a/llvm/test/CodeGen/DirectX/ContainerData/PDBParts.test b/llvm/test/CodeGen/DirectX/ContainerData/PDBParts.test
index 8fc7f5adb4e9c..26923c0b8afe9 100644
--- a/llvm/test/CodeGen/DirectX/ContainerData/PDBParts.test
+++ b/llvm/test/CodeGen/DirectX/ContainerData/PDBParts.test
@@ -1,5 +1,5 @@
 RUN: rm -rf %t && mkdir %t
-RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj -o %t.dxbc --dx-pdb-file=%t/parts.pdb
+RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj -o %t.dxbc --dx-pdb-path=%t/parts.pdb
 RUN: llvm-pdbutil pdb2yaml --dxcontainer %t/parts.pdb | FileCheck %s
 
 # Check that debug-related container parts are emitted into companion PDB file.

diff  --git a/llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Args.ll b/llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Args.ll
index 9b22812e212df..4b6287d31f509 100644
--- a/llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Args.ll
+++ b/llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Args.ll
@@ -1,4 +1,5 @@
-; RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj -o - | obj2yaml | FileCheck %s --check-prefix=DXC
+; RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj --dx-pdb-path=%t.pdb -o /dev/null
+; RUN: llvm-pdbutil pdb2yaml --dxcontainer %t.pdb | FileCheck %s --check-prefix=DXC
 
 ; DXC:      - Name:            SRCI
 ; DXC:        SourceInfo:

diff  --git a/llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Compressed.ll b/llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Compressed.ll
index 1d7e39fb77ff2..8e3b4eb56784b 100644
--- a/llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Compressed.ll
+++ b/llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Compressed.ll
@@ -1,5 +1,6 @@
 ; RUN: opt %S/Inputs/SourceInfo.ll -dxil-embed -dxil-globals -S -o - | FileCheck %s
-; RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj -o - | obj2yaml | FileCheck %s --check-prefix=DXC
+; RUN: llc %S/Inputs/SourceInfo.ll --filetype=obj --dx-pdb-path=%t.pdb -o /dev/null
+; RUN: llvm-pdbutil pdb2yaml --dxcontainer %t.pdb | FileCheck %s --check-prefix=DXC
 ; REQUIRES: zlib
 
 ; CHECK: @dx.srci = private constant [348 x i8] c"{{.*}}", section "SRCI", align 4

diff  --git a/llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Uncompressed.ll b/llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Uncompressed.ll
index df42386f1c418..e43056b106d94 100644
--- a/llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Uncompressed.ll
+++ b/llvm/test/CodeGen/DirectX/ContainerData/SourceInfo-Uncompressed.ll
@@ -1,5 +1,6 @@
 ; RUN: opt %S/Inputs/SourceInfo.ll -compress-srci=none -dxil-embed -dxil-globals -S -o - | FileCheck %s
-; RUN: llc %S/Inputs/SourceInfo.ll -compress-srci=none --filetype=obj -o - | obj2yaml | FileCheck %s --check-prefix=DXC
+; RUN: llc %S/Inputs/SourceInfo.ll -compress-srci=none --filetype=obj --dx-pdb-path=%t.pdb -o /dev/null
+; RUN: llvm-pdbutil pdb2yaml --dxcontainer %t.pdb | FileCheck %s --check-prefix=DXC
 
 ; CHECK: @dx.srci = private constant [416 x i8] c"{{.*}}", section "SRCI", align 4
 

diff  --git a/llvm/test/CodeGen/DirectX/embed-ildb.ll b/llvm/test/CodeGen/DirectX/embed-ildb.ll
index 5f1b17e0e1e56..b1203bb1b3fcf 100644
--- a/llvm/test/CodeGen/DirectX/embed-ildb.ll
+++ b/llvm/test/CodeGen/DirectX/embed-ildb.ll
@@ -1,6 +1,6 @@
 ; RUN: rm -f %t.pdb
 ; RUN: opt %s -dxil-embed -dxil-globals -S -o - | FileCheck %s
-; RUN: llc %s --filetype=obj -o %t.bc --dx-pdb-file=%t.pdb
+; RUN: llc %s --filetype=obj --dx-embed-debug -o %t.bc --dx-pdb-path=%t.pdb
 ; RUN: obj2yaml %t.bc | FileCheck %s --check-prefix=YAML
 ; RUN: llvm-objcopy --dump-section=ILDB=%t.ildb %t.bc
 ; RUN: llvm-objcopy --dump-section=DXIL=%t.dxil %t.bc
@@ -40,11 +40,11 @@ define i32 @add(i32 %a, i32 %b) {
 !7 = !{!"hlsl.hlsl"}
 !8 = !{!"-T", !"lib_6_5", !"-g", !"hlsl.hlsl"}
 
-; Check that DXIL, ILDB and SRCI parts are emitted as a GV and used by the compiler.
+
+; Check that DXIL and ILDB parts are emitted as a GV and used by the compiler.
 
 ; CHECK: @dx.ildb = private constant [[BC_TYPE:\[[0-9]+ x i8\]]] c"BC\C0\DE{{[^"]+}}", section "ILDB", align 4
 ; CHECK: @dx.dxil = private constant [[BC_TYPE:\[[0-9]+ x i8\]]] c"BC\C0\DE{{[^"]+}}", section "DXIL", align 4
-; CHECK: @dx.srci = private constant {{\[[0-9]+ x i8\]}}
 ; CHECK: @llvm.compiler.used = appending global {{\[[0-9]+ x ptr\]}} [ptr @dx.ildb, ptr @dx.dxil
 
 ; This is using regex matches on some sizes, offsets and fields. These are all
@@ -89,9 +89,6 @@ define i32 @add(i32 %a, i32 %b) {
 ; YAML-NEXT:       DXILSize:        [[#DXILSIZE - 24]]
 ; YAML-NEXT:       DXIL:            [ 0x42, 0x43, 0xC0, 0xDE,
 
-; Check that despite dx.source is stripped from DXIL, SRCI is still emitted:
-; YAML:   - Name:            SRCI
-
 ; Check that ILDB has the debug info, and DXIL does not:
 
 ; ILDB-DIS: define i32 @add(i32 %a, i32 %b)


        


More information about the llvm-commits mailing list