[PATCH] D158051: [DirectX] Only embed dxil when writing object files

Justin Bogner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 13:13:46 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG72017fcf00b3: [DirectX] Only embed dxil when writing object files (authored by bogner).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158051/new/

https://reviews.llvm.org/D158051

Files:
  llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
  llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll
  llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll
  llvm/test/CodeGen/DirectX/embed-dxil.ll


Index: llvm/test/CodeGen/DirectX/embed-dxil.ll
===================================================================
--- llvm/test/CodeGen/DirectX/embed-dxil.ll
+++ llvm/test/CodeGen/DirectX/embed-dxil.ll
@@ -1,4 +1,3 @@
-; RUN: llc %s --filetype=asm -o - | FileCheck %s
 ; RUN: opt %s -dxil-embed -S -o - | FileCheck %s
 ; RUN: llc %s --filetype=obj -o - | obj2yaml | FileCheck %s --check-prefix=DXC
 target triple = "dxil-unknown-shadermodel6.5-library"
Index: llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll
===================================================================
--- llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll
+++ llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll
@@ -1,4 +1,4 @@
-; RUN: llc %s --filetype=asm -o - | FileCheck %s
+; RUN: opt %s -dxil-embed -dxil-globals -S -o - | FileCheck %s
 ; RUN: llc %s --filetype=obj -o - | obj2yaml | FileCheck %s --check-prefix=DXC
 target triple = "dxil-unknown-shadermodel6.5-library"
 
Index: llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll
===================================================================
--- llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll
+++ llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll
@@ -1,4 +1,4 @@
-; RUN: llc %s --filetype=asm -o - | FileCheck %s
+; RUN: opt %s -dxil-embed -dxil-globals -S -o - | FileCheck %s
 ; RUN: llc %s --filetype=obj -o - | obj2yaml | FileCheck %s --check-prefix=DXC
 target triple = "dxil-unknown-shadermodel6.5-library"
 
Index: llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
===================================================================
--- llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
+++ llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
@@ -42,6 +42,7 @@
   initializeDXILPrepareModulePass(*PR);
   initializeEmbedDXILPassPass(*PR);
   initializeWriteDXILPassPass(*PR);
+  initializeDXContainerGlobalsPass(*PR);
   initializeDXILOpLoweringLegacyPass(*PR);
   initializeDXILTranslateMetadataPass(*PR);
   initializeDXILResourceWrapperPass(*PR);
@@ -127,12 +128,6 @@
   TargetPassConfig *PassConfig = createPassConfig(PM);
   PassConfig->addCodeGenPrepare();
 
-  if (TargetPassConfig::willCompleteCodeGenPipeline()) {
-    PM.add(createDXILEmbedderPass());
-    // We embed the other DXContainer globals after embedding DXIL so that the
-    // globals don't pollute the DXIL.
-    PM.add(createDXContainerGlobalsPass());
-  }
   switch (FileType) {
   case CGFT_AssemblyFile:
     PM.add(createDXILPrettyPrinterPass(Out));
@@ -140,6 +135,11 @@
     break;
   case CGFT_ObjectFile:
     if (TargetPassConfig::willCompleteCodeGenPipeline()) {
+      PM.add(createDXILEmbedderPass());
+      // We embed the other DXContainer globals after embedding DXIL so that the
+      // globals don't pollute the DXIL.
+      PM.add(createDXContainerGlobalsPass());
+
       if (!MMIWP)
         MMIWP = new MachineModuleInfoWrapperPass(this);
       PM.add(MMIWP);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158051.550854.patch
Type: text/x-patch
Size: 2939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230816/f5f2bf28/attachment.bin>


More information about the llvm-commits mailing list