|
| 1 | +; Compare source info emission with and without --dx-source-in-debug-module flag. |
| 2 | + |
| 3 | +; RUN: llc %s --filetype=obj -o %t.dxbc |
| 4 | +; RUN: obj2yaml %t.dxbc | FileCheck %s --check-prefix=DXC |
| 5 | +; RUN: llvm-objcopy --dump-section=DXIL=%t.dxil.bc %t.dxbc |
| 6 | +; RUN: llvm-objcopy --dump-section=ILDB=%t.ildb.bc %t.dxbc |
| 7 | +; RUN: llvm-dis %t.dxil.bc -o - | FileCheck %s --check-prefix=DXIL-DIS |
| 8 | +; RUN: llvm-dis %t.ildb.bc -o - | FileCheck %s --check-prefix=ILDB-DIS |
| 9 | + |
| 10 | +; RUN: llc %s --filetype=obj -o %t.dxbc --dx-source-in-debug-module |
| 11 | +; RUN: obj2yaml %t.dxbc | FileCheck %s --check-prefix=DXC-SOURCE |
| 12 | +; RUN: llvm-objcopy --dump-section=DXIL=%t.dxil.bc %t.dxbc |
| 13 | +; RUN: llvm-objcopy --dump-section=ILDB=%t.ildb.bc %t.dxbc |
| 14 | +; RUN: llvm-dis %t.dxil.bc -o - | FileCheck %s --check-prefix=DXIL-SOURCE-DIS |
| 15 | +; RUN: llvm-dis %t.ildb.bc -o - | FileCheck %s --check-prefix=ILDB-SOURCE-DIS |
| 16 | + |
| 17 | +; Without the flag, dx.source should be stripped away from DXIL, and replaced |
| 18 | +; with dummy metadata in ILDB. |
| 19 | +; DXIL-DIS-NOT: dx.source |
| 20 | +; ILDB-DIS: !dx.source.contents = !{![[CONTENTS:[0-9]+]]} |
| 21 | +; ILDB-DIS: !dx.source.defines = !{![[EMPTY_ARR:[0-9]+]]} |
| 22 | +; ILDB-DIS: !dx.source.mainFileName = !{![[MAIN:[0-9]+]]} |
| 23 | +; ILDB-DIS: !dx.source.args = !{![[EMPTY_ARR]]} |
| 24 | +; ILDB-DIS: ![[CONTENTS]] = !{!"", !""} |
| 25 | +; ILDB-DIS: ![[EMPTY_ARR]] = !{} |
| 26 | +; ILDB-DIS: ![[MAIN]] = !{!""} |
| 27 | + |
| 28 | +; Without the flag, SRCI should be emitted. |
| 29 | +; DXC: - Name: SRCI |
| 30 | +; DXC-NEXT: Size: 348 |
| 31 | +; DXC-NEXT: SourceInfo: |
| 32 | +; DXC-NEXT: Header: |
| 33 | +; DXC: SectionCount: 3 |
| 34 | +; DXC-NEXT: Names: |
| 35 | +; DXC-NEXT: SectionHeader: |
| 36 | +; DXC: Type: SourceNames |
| 37 | +; DXC-NEXT: Header: |
| 38 | +; DXC: Count: 3 |
| 39 | +; DXC: Entries: |
| 40 | +; DXC: FileName: 'C:\dx-source-metadata.hlsl' |
| 41 | +; DXC: FileName: 'C:\a.hlsl' |
| 42 | +; DXC: FileName: 'C:\b.hlsl' |
| 43 | +; DXC-NEXT: Contents: |
| 44 | +; DXC-NEXT: SectionHeader: |
| 45 | +; DXC: Type: SourceContents |
| 46 | +; DXC-NEXT: Header: |
| 47 | +; DXC: Count: 3 |
| 48 | +; DXC: Entries: |
| 49 | +; DXC: FileContent: "#include \"a.hlsl\"\n#include \"b.hlsl\"\n\nfloat foo(float a, float b) {\n return a + b;\n}\n" |
| 50 | +; DXC: FileContent: "#include \"b.hlsl\"\n" |
| 51 | +; DXC: FileContent: "#include <c.hlsl>\n" |
| 52 | +; DXC: Args: |
| 53 | +; DXC: SectionHeader: |
| 54 | +; DXC: Header: |
| 55 | +; DXC: Count: 5 |
| 56 | +; DXC: Args: |
| 57 | +; DXC-NEXT: - Arg: '-g' |
| 58 | +; DXC-NEXT: Value: '' |
| 59 | +; DXC-NEXT: - Arg: '-Tlib_6_3' |
| 60 | +; DXC-NEXT: Value: '' |
| 61 | +; DXC-NEXT: - Arg: '-DUSER_DEF0=42' |
| 62 | +; DXC-NEXT: Value: '' |
| 63 | +; DXC-NEXT: - Arg: '-DUSER_DEF1=43' |
| 64 | +; DXC-NEXT: Value: '' |
| 65 | +; DXC-NEXT: - Arg: 'C:\\dx-source-metadata.hlsl' |
| 66 | +; DXC-NEXT: Value: '' |
| 67 | + |
| 68 | +; With the flag, dx.source should be stripped away from DXIL, and kept untouched in ILDB. |
| 69 | +; DXIL-SOURCE-DIS-NOT: dx.source |
| 70 | +; ILDB-SOURCE-DIS: !dx.source.args = !{![[ARGS:[0-9]+]]} |
| 71 | +; ILDB-SOURCE-DIS: !dx.source.contents = !{![[FILE1:[0-9]+]], ![[FILE2:[0-9]+]], ![[FILE3:[0-9]+]]} |
| 72 | +; ILDB-SOURCE-DIS: !dx.source.mainFileName = !{![[MAIN:[0-9]+]]} |
| 73 | +; ILDB-SOURCE-DIS: !dx.source.defines = !{![[DEFINES:[0-9]+]]} |
| 74 | +; ILDB-SOURCE-DIS: ![[FILE1]] = !{!"C:\\dx-source-metadata.hlsl", |
| 75 | +; ILDB-SOURCE-DIS: ![[FILE2]] = !{!"C:\\a.hlsl" |
| 76 | +; ILDB-SOURCE-DIS: ![[FILE3]] = !{!"C:\\b.hlsl" |
| 77 | +; ILDB-SOURCE-DIS: ![[MAIN]] = !{!"C:\\dx-source-metadata.hlsl"} |
| 78 | +; ILDB-SOURCE-DIS: ![[DEFINES]] = !{!"USER_DEF0=42", !"USER_DEF1=43"} |
| 79 | + |
| 80 | +; With the flag, SRCI should not be emitted. |
| 81 | +; DXC-SOURCE-NOT: - Name: SRCI |
| 82 | + |
| 83 | +target triple = "dxilv1.3-pc-shadermodel6.3-library" |
| 84 | + |
| 85 | +define float @_Z3fooff(float %a, float %b) { |
| 86 | +entry: |
| 87 | + %add = fadd float %a, %b |
| 88 | + ret float %add |
| 89 | +} |
| 90 | + |
| 91 | +!llvm.dbg.cu = !{!4} |
| 92 | +!llvm.module.flags = !{!6, !7} |
| 93 | + |
| 94 | +!dx.source.args = !{!0} |
| 95 | +!dx.source.contents = !{!1, !2, !3} |
| 96 | +!dx.source.mainFileName = !{!8} |
| 97 | +!dx.source.defines = !{!9} |
| 98 | + |
| 99 | +!0 = !{!"-g", !"-Tlib_6_3", !"-DUSER_DEF0=42", !"-DUSER_DEF1=43", !"C:\\\\dx-source-metadata.hlsl"} |
| 100 | +!1 = !{!"C:\\dx-source-metadata.hlsl", !"#include \22a.hlsl\22\0A#include \22b.hlsl\22\0A\0Afloat foo(float a, float b) {\0A return a + b;\0A}\0A"} |
| 101 | +!2 = !{!"C:\\a.hlsl", !"#include \22b.hlsl\22\0A"} |
| 102 | +!3 = !{!"C:\\b.hlsl", !"#include <c.hlsl>\0A"} |
| 103 | +!4 = distinct !DICompileUnit(language: DW_LANG_C99, file: !5, emissionKind: FullDebug) |
| 104 | +!5 = !DIFile(filename: "dx-source-metadata.hlsl", directory: "C:\\") |
| 105 | +!6 = !{i32 2, !"Dwarf Version", i32 4} |
| 106 | +!7 = !{i32 2, !"Debug Info Version", i32 3} |
| 107 | +!8 = !{!"C:\\dx-source-metadata.hlsl"} |
| 108 | +!9 = !{!"USER_DEF0=42", !"USER_DEF1=43"} |
0 commit comments