From 78a73dda601279b33691e6fb67047155c2390af6 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Sat, 7 Jan 2023 23:31:26 -0500 Subject: [PATCH] [DirectX backend] PartSize not include PartHeader PartSize for a part in dx container is only the size of the content of the part, not include size of the PartHeader. Differential Revision: https://reviews.llvm.org/D141207 --- llvm/lib/MC/MCDXContainerWriter.cpp | 2 +- llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll | 2 +- llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll | 2 +- llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll | 2 +- llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll | 2 +- llvm/test/CodeGen/DirectX/embed-dxil.ll | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/llvm/lib/MC/MCDXContainerWriter.cpp b/llvm/lib/MC/MCDXContainerWriter.cpp index ddccc10..028bfe6 100644 --- a/llvm/lib/MC/MCDXContainerWriter.cpp +++ b/llvm/lib/MC/MCDXContainerWriter.cpp @@ -104,7 +104,7 @@ uint64_t DXContainerObjectWriter::writeObject(MCAssembler &Asm, // Write section header. W.write(ArrayRef(Sec.getName().data(), 4)); - uint64_t PartSize = SectionSize + sizeof(dxbc::PartHeader); + uint64_t PartSize = SectionSize; if (Sec.getName() == "DXIL") PartSize += sizeof(dxbc::ProgramHeader); diff --git a/llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll b/llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll index 8e69242..2678826 100644 --- a/llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll +++ b/llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll @@ -19,7 +19,7 @@ define i32 @add(i32 %a, i32 %b) { !4 = !{i32 2, !"Debug Info Version", i32 3} ; DXC: - Name: HASH -; DXC: Size: 28 +; DXC: Size: 20 ; DXC: Hash: ; DXC: IncludesSource: true ; DXC: Digest: [ diff --git a/llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll b/llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll index 327d355..0200872 100644 --- a/llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll +++ b/llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll @@ -10,7 +10,7 @@ define i32 @add(i32 %a, i32 %b) { } ; DXC: - Name: HASH -; DXC: Size: 28 +; DXC: Size: 20 ; DXC: Hash: ; DXC: IncludesSource: false ; DXC: Digest: [ diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll index 26487ca..865fefe 100644 --- a/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll +++ b/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll @@ -15,7 +15,7 @@ define double @div(double %a, double %b) { ; DXC: - Name: SFI0 -; DXC-NEXT: Size: 16 +; DXC-NEXT: Size: 8 ; DXC-NEXT: Flags: ; DXC-NEXT: Doubles: true ; DXC-NOT: {{[A-Za-z]+: +true}} diff --git a/llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll index 95320dd..f90db61 100644 --- a/llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll +++ b/llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll @@ -13,7 +13,7 @@ define double @add(double %a, double %b) { } ; DXC: - Name: SFI0 -; DXC-NEXT: Size: 16 +; DXC-NEXT: Size: 8 ; DXC-NEXT: Flags: ; DXC-NEXT: Doubles: true ; DXC-NOT: {{[A-Za-z]+: +true}} diff --git a/llvm/test/CodeGen/DirectX/embed-dxil.ll b/llvm/test/CodeGen/DirectX/embed-dxil.ll index bea6f60..b9a3e8c 100644 --- a/llvm/test/CodeGen/DirectX/embed-dxil.ll +++ b/llvm/test/CodeGen/DirectX/embed-dxil.ll @@ -42,11 +42,11 @@ define i32 @add(i32 %a, i32 %b) { ; DXC-NEXT: MajorVersion: 6 ; DXC-NEXT: MinorVersion: 5 ; DXC-NEXT: ShaderKind: 6 -; DXC-NEXT: Size: [[#div(SIZE,4) - 2]] +; DXC-NEXT: Size: [[#div(SIZE,4)]] ; DXC-NEXT: DXILMajorVersion: [[#]] ; DXC-NEXT: DXILMinorVersion: [[#]] -; DXC-NEXT: DXILSize: [[#SIZE - 32]] +; DXC-NEXT: DXILSize: [[#SIZE - 24]] ; DXC-NEXT: DXIL: [ 0x42, 0x43, 0xC0, 0xDE, ; DXC: - Name: SFI0 -; DXC-NEXT: Size: 16 +; DXC-NEXT: Size: 8 ; DXC-NOT: Flags: -- 2.7.4