Home | History | Annotate | Download | only in X86
      1 # RUN: llc -march=x86-64 -start-after machine-sink -stop-after machine-sink -o /dev/null %s | FileCheck %s
      2 # This test ensures that the MIR parser parses the machine instruction's
      3 # debug location metadata correctly.
      4 
      5 --- |
      6 
      7   define i32 @test(i32 %x) #0 !dbg !4 {
      8   entry:
      9     %x.addr = alloca i32, align 4
     10     store i32 %x, i32* %x.addr, align 4
     11     call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !13), !dbg !14
     12     %0 = load i32, i32* %x.addr, align 4, !dbg !15
     13     ret i32 %0, !dbg !15
     14   }
     15 
     16   define i32 @test_typed_immediates(i32 %x) #0 {
     17   entry:
     18     %x.addr = alloca i32, align 4
     19     store i32 %x, i32* %x.addr, align 4
     20     call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !13), !dbg !14
     21     %0 = load i32, i32* %x.addr, align 4, !dbg !15
     22     ret i32 %0, !dbg !15
     23   }
     24 
     25   declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
     26 
     27   attributes #0 = { nounwind "no-frame-pointer-elim"="false" }
     28   attributes #1 = { nounwind readnone }
     29 
     30   !llvm.dbg.cu = !{!0}
     31   !llvm.module.flags = !{!9, !10}
     32   !llvm.ident = !{!11}
     33 
     34   !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)
     35   !1 = !DIFile(filename: "test.ll", directory: "")
     36   !2 = !{}
     37   !3 = !{!4}
     38   !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)
     39   !5 = !DIFile(filename: "test.c", directory: "")
     40   !6 = !DISubroutineType(types: !7)
     41   !7 = !{!8, !8}
     42   !8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
     43   !9 = !{i32 2, !"Dwarf Version", i32 4}
     44   !10 = !{i32 2, !"Debug Info Version", i32 3}
     45   !11 = !{!"clang version 3.7.0"}
     46   !12 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 4, type: !8)
     47   !13 = !DIExpression()
     48   !14 = !DILocation(line: 4, scope: !4)
     49   !15 = !DILocation(line: 8, scope: !4)
     50 
     51 ...
     52 ---
     53 name:            test
     54 isSSA:           true
     55 tracksRegLiveness: true
     56 registers:
     57   - { id: 0, class: gr32 }
     58 frameInfo:
     59   maxAlignment:  4
     60 stack:
     61   - { id: 0, name: x.addr, size: 4, alignment: 4 }
     62 body: |
     63   bb.0.entry:
     64     liveins: %edi
     65     ; CHECK: DBG_VALUE debug-use _, 0, !12, !13, debug-location !14
     66     ; CHECK: %eax = COPY %0, debug-location !15
     67     ; CHECK: RETQ %eax, debug-location !15
     68     %0 = COPY %edi
     69     DBG_VALUE debug-use _, 0, !12, !13, debug-location !14
     70     MOV32mr %stack.0.x.addr, 1, _, 0, _, %0
     71     %eax = COPY %0, debug-location !15
     72     RETQ %eax, debug-location !15
     73 ...
     74 ---
     75 name:            test_typed_immediates
     76 isSSA:           true
     77 tracksRegLiveness: true
     78 registers:
     79   - { id: 0, class: gr32 }
     80 frameInfo:
     81   maxAlignment:  4
     82 stack:
     83   - { id: 0, name: x.addr, size: 4, alignment: 4 }
     84 body: |
     85   bb.0.entry:
     86     liveins: %edi
     87 
     88     %0 = COPY %edi
     89   ; CHECK:      DBG_VALUE _, i32 0, !12, !13
     90   ; CHECK-NEXT: DBG_VALUE _, i64 -22, !12, !13
     91   ; CHECK-NEXT: DBG_VALUE _, i128 123492148938512984928424384934328985928, !12, !13
     92     DBG_VALUE _, i32 0, !12, !13
     93     DBG_VALUE _, i64 -22, !12, !13
     94     DBG_VALUE _, i128 123492148938512984928424384934328985928, !12, !13
     95     MOV32mr %stack.0.x.addr, 1, _, 0, _, %0
     96     %eax = COPY %0
     97     RETQ %eax
     98 ...
     99