diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2015-07-22 21:15:11 +0000 |
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2015-07-22 21:15:11 +0000 |
| commit | 46d760d161d4d6255d02cde48831c079fb362769 (patch) | |
| tree | 4e8afa5095c4eef9512f4a66b0592f5a186ed855 /llvm/test/CodeGen/MIR/X86 | |
| parent | 2873810c6f81a288bcb53b0da9af4c21858a4f20 (diff) | |
| download | bcm5719-llvm-46d760d161d4d6255d02cde48831c079fb362769.tar.gz bcm5719-llvm-46d760d161d4d6255d02cde48831c079fb362769.zip | |
MIR Serialization: Serialize the machine instruction's debug location.
llvm-svn: 242938
Diffstat (limited to 'llvm/test/CodeGen/MIR/X86')
| -rw-r--r-- | llvm/test/CodeGen/MIR/X86/expected-metadata-node-after-debug-location.mir | 61 | ||||
| -rw-r--r-- | llvm/test/CodeGen/MIR/X86/instructions-debug-location.mir | 65 |
2 files changed, 126 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/MIR/X86/expected-metadata-node-after-debug-location.mir b/llvm/test/CodeGen/MIR/X86/expected-metadata-node-after-debug-location.mir new file mode 100644 index 00000000000..14143751096 --- /dev/null +++ b/llvm/test/CodeGen/MIR/X86/expected-metadata-node-after-debug-location.mir @@ -0,0 +1,61 @@ +# RUN: not llc -march=x86-64 -start-after machine-sink -stop-after machine-sink -o /dev/null %s 2>&1 | FileCheck %s + +--- | + + define i32 @test(i32 %x) #0 { + entry: + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !13), !dbg !14 + %0 = load i32, i32* %x.addr, align 4, !dbg !15 + ret i32 %0, !dbg !15 + } + + declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + + attributes #0 = { nounwind "no-frame-pointer-elim"="false" } + attributes #1 = { nounwind readnone } + + !llvm.dbg.cu = !{!0} + !llvm.module.flags = !{!9, !10} + !llvm.ident = !{!11} + + !0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) + !1 = !DIFile(filename: "test.ll", directory: "") + !2 = !{} + !3 = !{!4} + !4 = !DISubprogram(name: "test", scope: !5, file: !5, line: 4, type: !6, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, function: i32 (i32)* @test, variables: !2) + !5 = !DIFile(filename: "test.c", directory: "") + !6 = !DISubroutineType(types: !7) + !7 = !{!8, !8} + !8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) + !9 = !{i32 2, !"Dwarf Version", i32 4} + !10 = !{i32 2, !"Debug Info Version", i32 3} + !11 = !{!"clang version 3.7.0"} + !12 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "x", arg: 1, scope: !4, file: !5, line: 4, type: !8) + !13 = !DIExpression() + !14 = !DILocation(line: 4, scope: !4) + !15 = !DILocation(line: 8, scope: !4) + +... +--- +name: test +isSSA: true +tracksRegLiveness: true +registers: + - { id: 0, class: gr32 } +frameInfo: + maxAlignment: 4 +stack: + - { id: 0, name: x.addr, size: 4, alignment: 4 } +body: + - id: 0 + name: entry + instructions: + - '%0 = COPY %edi' + # CHECK: [[@LINE+1]]:51: expected a metadata node after 'debug-location' + - 'DBG_VALUE _, 0, !12, !13, debug-location 14' + - 'MOV32mr %stack.x.addr, 1, _, 0, _, %0' + - '%eax = COPY %0' + - 'RETQ %eax' +... diff --git a/llvm/test/CodeGen/MIR/X86/instructions-debug-location.mir b/llvm/test/CodeGen/MIR/X86/instructions-debug-location.mir new file mode 100644 index 00000000000..c769666b9af --- /dev/null +++ b/llvm/test/CodeGen/MIR/X86/instructions-debug-location.mir @@ -0,0 +1,65 @@ +# RUN: llc -march=x86-64 -start-after machine-sink -stop-after machine-sink -o /dev/null %s | FileCheck %s +# This test ensures that the MIR parser parses the machine instruction's +# debug location metadata correctly. + +--- | + + define i32 @test(i32 %x) #0 { + entry: + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !13), !dbg !14 + %0 = load i32, i32* %x.addr, align 4, !dbg !15 + ret i32 %0, !dbg !15 + } + + declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 + + attributes #0 = { nounwind "no-frame-pointer-elim"="false" } + attributes #1 = { nounwind readnone } + + !llvm.dbg.cu = !{!0} + !llvm.module.flags = !{!9, !10} + !llvm.ident = !{!11} + + !0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) + !1 = !DIFile(filename: "test.ll", directory: "") + !2 = !{} + !3 = !{!4} + !4 = !DISubprogram(name: "test", scope: !5, file: !5, line: 4, type: !6, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, function: i32 (i32)* @test, variables: !2) + !5 = !DIFile(filename: "test.c", directory: "") + !6 = !DISubroutineType(types: !7) + !7 = !{!8, !8} + !8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) + !9 = !{i32 2, !"Dwarf Version", i32 4} + !10 = !{i32 2, !"Debug Info Version", i32 3} + !11 = !{!"clang version 3.7.0"} + !12 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "x", arg: 1, scope: !4, file: !5, line: 4, type: !8) + !13 = !DIExpression() + !14 = !DILocation(line: 4, scope: !4) + !15 = !DILocation(line: 8, scope: !4) + +... +--- +name: test +isSSA: true +tracksRegLiveness: true +registers: + - { id: 0, class: gr32 } +frameInfo: + maxAlignment: 4 +stack: + - { id: 0, name: x.addr, size: 4, alignment: 4 } +body: + - id: 0 + name: entry + instructions: + # CHECK: DBG_VALUE _, 0, !12, !13, debug-location !14 + # CHECK: %eax = COPY %0, debug-location !15 + # CHECK: RETQ %eax, debug-location !15 + - '%0 = COPY %edi' + - 'DBG_VALUE _, 0, !12, !13, debug-location !14' + - 'MOV32mr %stack.0.x.addr, 1, _, 0, _, %0' + - '%eax = COPY %0, debug-location !15' + - 'RETQ %eax, debug-location !15' +... |

