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

Finn Plummer via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 15 10:25:13 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";
+  StringRef DL = "e-m:e-p:32:32-i1:8-i8:8-i16:32-i32:32-i64:64-"
+                 "f16:32-f32:32-f64:64-n8:16:32:64";
----------------
inbelic wrote:

I am confused why this data layout is different from the data layout specified in the other pr, [here](https://github.com/llvm/llvm-project/pull/160955/files#r2411824892). Is that intentional?

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


More information about the llvm-commits mailing list