[llvm] [DirectX] Move triple/DL compat to bitcode writer (PR #163587)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 15 09:35:07 PDT 2025


================
@@ -1165,12 +1165,15 @@ void DXILBitcodeWriter::writeValueSymbolTableForwardDecl() {}
 /// Returns the bit offset to backpatch with the location of the real VST.
 void DXILBitcodeWriter::writeModuleInfo() {
   // Emit various pieces of data attached to a module.
-  if (!M.getTargetTriple().empty())
-    writeStringRecord(Stream, bitc::MODULE_CODE_TRIPLE,
-                      M.getTargetTriple().str(), 0 /*TODO*/);
-  const std::string &DL = M.getDataLayoutStr();
-  if (!DL.empty())
-    writeStringRecord(Stream, bitc::MODULE_CODE_DATALAYOUT, DL, 0 /*TODO*/);
+
+  // We need to hardcode a triple and datalayout that's compatible with the
+  // historical DXIL triple and datalayout from DXC.
+  StringRef Triple = "dxil-ms-dx";
----------------
bogner wrote:

It may make sense to assert here that `M.getTargetTriple()` is DXIL before ignoring it. This is all deep in the DirectX backend though so the value of that check seems kind of low.

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


More information about the llvm-commits mailing list