diff options
Diffstat (limited to 'test/CodeGen/MIR/X86/instructions-debug-location.mir')
-rw-r--r-- | test/CodeGen/MIR/X86/instructions-debug-location.mir | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/test/CodeGen/MIR/X86/instructions-debug-location.mir b/test/CodeGen/MIR/X86/instructions-debug-location.mir new file mode 100644 index 000000000000..ea2cdbf7cb2f --- /dev/null +++ b/test/CodeGen/MIR/X86/instructions-debug-location.mir @@ -0,0 +1,98 @@ +# 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 !dbg !4 { + 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 + } + + define i32 @test_typed_immediates(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 = distinct !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 = distinct !DISubprogram(name: "test", scope: !5, file: !5, line: 4, type: !6, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, 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(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: | + bb.0.entry: + liveins: %edi + ; CHECK: DBG_VALUE debug-use _, 0, !12, !13, debug-location !14 + ; CHECK: %eax = COPY %0, debug-location !15 + ; CHECK: RETQ %eax, debug-location !15 + %0 = COPY %edi + DBG_VALUE debug-use _, 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 +... +--- +name: test_typed_immediates +isSSA: true +tracksRegLiveness: true +registers: + - { id: 0, class: gr32 } +frameInfo: + maxAlignment: 4 +stack: + - { id: 0, name: x.addr, size: 4, alignment: 4 } +body: | + bb.0.entry: + liveins: %edi + + %0 = COPY %edi + ; CHECK: DBG_VALUE _, i32 0, !12, !13 + ; CHECK-NEXT: DBG_VALUE _, i64 -22, !12, !13 + ; CHECK-NEXT: DBG_VALUE _, i128 123492148938512984928424384934328985928, !12, !13 + DBG_VALUE _, i32 0, !12, !13 + DBG_VALUE _, i64 -22, !12, !13 + DBG_VALUE _, i128 123492148938512984928424384934328985928, !12, !13 + MOV32mr %stack.0.x.addr, 1, _, 0, _, %0 + %eax = COPY %0 + RETQ %eax +... |