Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s | FileCheck %s --check-prefix=ASM
      2 ; RUN: llc < %s -filetype=obj | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF
      3 
      4 ; Values in registers should be clobbered by calls, which use a regmask instead
      5 ; of individual register def operands.
      6 
      7 ; ASM: main: # @main
      8 ; ASM: #DEBUG_VALUE: main:argc <- %ECX
      9 ; ASM: movl $1, x(%rip)
     10 ; ASM: callq clobber
     11 ; ASM-NEXT: [[argc_range_end:.Ltmp[0-9]+]]:
     12 ; Previously LiveDebugValues would claim argc was still in ECX after the call.
     13 ; ASM-NOT: #DEBUG_VALUE: main:argc
     14 
     15 ; argc is the first debug location.
     16 ; ASM: .Ldebug_loc1:
     17 ; ASM-NEXT: .quad   .Lfunc_begin0-.Lfunc_begin0
     18 ; ASM-NEXT: .quad   [[argc_range_end]]-.Lfunc_begin0
     19 ; ASM-NEXT: .short  3                       # Loc expr size
     20 ; ASM-NEXT: .byte   82                      # super-register DW_OP_reg2
     21 ; ASM-NEXT: .byte   147                     # DW_OP_piece
     22 ; ASM-NEXT: .byte   4                       # 4
     23 
     24 ; argc is the first formal parameter.
     25 ; DWARF: .debug_info contents:
     26 ; DWARF:  DW_TAG_formal_parameter
     27 ; DWARF-NEXT:    DW_AT_location [DW_FORM_sec_offset]   ([[argc_loc_offset:0x.*]])
     28 ; DWARF-NEXT:    DW_AT_name [DW_FORM_strp]     {{.*}} "argc"
     29 
     30 ; DWARF: .debug_loc contents:
     31 ; DWARF: [[argc_loc_offset]]: Beginning address offset: 0x0000000000000000
     32 ; DWARF-NEXT:                    Ending address offset: 0x0000000000000013
     33 ; DWARF-NEXT:                     Location description: 52 93 04
     34 
     35 ; ModuleID = 't.cpp'
     36 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
     37 target triple = "x86_64-pc-windows-msvc18.0.0"
     38 
     39 @x = common global i32 0, align 4
     40 
     41 ; Function Attrs: nounwind uwtable
     42 define i32 @main(i32 %argc, i8** nocapture readnone %argv) #0 !dbg !4 {
     43 entry:
     44   tail call void @llvm.dbg.value(metadata i8** %argv, i64 0, metadata !12, metadata !21), !dbg !22
     45   tail call void @llvm.dbg.value(metadata i32 %argc, i64 0, metadata !13, metadata !21), !dbg !23
     46   store volatile i32 1, i32* @x, align 4, !dbg !24, !tbaa !25
     47   tail call void @clobber() #3, !dbg !29
     48   store volatile i32 2, i32* @x, align 4, !dbg !30, !tbaa !25
     49   %0 = load volatile i32, i32* @x, align 4, !dbg !31, !tbaa !25
     50   %tobool = icmp eq i32 %0, 0, !dbg !31
     51   br i1 %tobool, label %if.else, label %if.then, !dbg !33
     52 
     53 if.then:                                          ; preds = %entry
     54   store volatile i32 3, i32* @x, align 4, !dbg !34, !tbaa !25
     55   br label %if.end, !dbg !36
     56 
     57 if.else:                                          ; preds = %entry
     58   store volatile i32 4, i32* @x, align 4, !dbg !37, !tbaa !25
     59   br label %if.end
     60 
     61 if.end:                                           ; preds = %if.else, %if.then
     62   ret i32 0, !dbg !39
     63 }
     64 
     65 declare void @clobber()
     66 
     67 ; Function Attrs: nounwind readnone
     68 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
     69 
     70 attributes #0 = { nounwind uwtable }
     71 attributes #2 = { nounwind readnone }
     72 attributes #3 = { nounwind }
     73 
     74 !llvm.dbg.cu = !{!0}
     75 !llvm.module.flags = !{!17, !18, !19}
     76 !llvm.ident = !{!20}
     77 
     78 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (trunk 260617) (llvm/trunk 260619)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !14)
     79 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
     80 !2 = !{}
     81 !4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !0, variables: !11)
     82 !5 = !DISubroutineType(types: !6)
     83 !6 = !{!7, !7, !8}
     84 !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
     85 !8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, align: 64)
     86 !9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64, align: 64)
     87 !10 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
     88 !11 = !{!12, !13}
     89 !12 = !DILocalVariable(name: "argv", arg: 2, scope: !4, file: !1, line: 4, type: !8)
     90 !13 = !DILocalVariable(name: "argc", arg: 1, scope: !4, file: !1, line: 4, type: !7)
     91 !14 = !{!15}
     92 !15 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 1, type: !16, isLocal: false, isDefinition: true, variable: i32* @x)
     93 !16 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
     94 !17 = !{i32 2, !"Dwarf Version", i32 4}
     95 !18 = !{i32 2, !"Debug Info Version", i32 3}
     96 !19 = !{i32 1, !"PIC Level", i32 2}
     97 !20 = !{!"clang version 3.9.0 (trunk 260617) (llvm/trunk 260619)"}
     98 !21 = !DIExpression()
     99 !22 = !DILocation(line: 4, column: 27, scope: !4)
    100 !23 = !DILocation(line: 4, column: 14, scope: !4)
    101 !24 = !DILocation(line: 5, column: 5, scope: !4)
    102 !25 = !{!26, !26, i64 0}
    103 !26 = !{!"int", !27, i64 0}
    104 !27 = !{!"omnipotent char", !28, i64 0}
    105 !28 = !{!"Simple C/C++ TBAA"}
    106 !29 = !DILocation(line: 6, column: 3, scope: !4)
    107 !30 = !DILocation(line: 7, column: 5, scope: !4)
    108 !31 = !DILocation(line: 8, column: 7, scope: !32)
    109 !32 = distinct !DILexicalBlock(scope: !4, file: !1, line: 8, column: 7)
    110 !33 = !DILocation(line: 8, column: 7, scope: !4)
    111 !34 = !DILocation(line: 9, column: 7, scope: !35)
    112 !35 = distinct !DILexicalBlock(scope: !32, file: !1, line: 8, column: 10)
    113 !36 = !DILocation(line: 10, column: 3, scope: !35)
    114 !37 = !DILocation(line: 11, column: 7, scope: !38)
    115 !38 = distinct !DILexicalBlock(scope: !32, file: !1, line: 10, column: 10)
    116 !39 = !DILocation(line: 13, column: 1, scope: !4)
    117