Home | History | Annotate | Download | only in X86
      1 ; RUN: llc -O2 < %s | FileCheck %s
      2 ; RUN: llc -O2 -regalloc=basic < %s | FileCheck %s
      3 ; Test to check that unused argument 'this' is not undefined in debug info.
      4 
      5 target triple = "x86_64-apple-darwin10.2"
      6 %struct.foo = type { i32 }
      7 
      8 @llvm.used = appending global [1 x i8*] [i8* bitcast (i32 (%struct.foo*, i32)* @_ZN3foo3bazEi to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
      9 
     10 define i32 @_ZN3foo3bazEi(%struct.foo* nocapture %this, i32 %x) nounwind readnone optsize noinline ssp align 2 {
     11 ;CHECK: DEBUG_VALUE: baz:this <- RDI{{$}}
     12 entry:
     13   tail call void @llvm.dbg.value(metadata %struct.foo* %this, i64 0, metadata !15, metadata !MDExpression()), !dbg !MDLocation(scope: !8)
     14   tail call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !16, metadata !MDExpression()), !dbg !MDLocation(scope: !8)
     15   %0 = mul nsw i32 %x, 7, !dbg !29                ; <i32> [#uses=1]
     16   %1 = add nsw i32 %0, 1, !dbg !29                ; <i32> [#uses=1]
     17   ret i32 %1, !dbg !29
     18 }
     19 
     20 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
     21 
     22 !llvm.dbg.cu = !{!4}
     23 !llvm.module.flags = !{!34}
     24 !llvm.dbg.lv = !{!0, !14, !15, !16, !17, !24, !25, !28}
     25 
     26 !0 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", line: 11, arg: 0, scope: !1, file: !3, type: !12)
     27 !1 = !MDSubprogram(name: "bar", linkageName: "_ZN3foo3barEi", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, scopeLine: 11, file: !31, scope: !2, type: !9, function: i32 (%struct.foo*, i32)* null)
     28 !2 = !MDCompositeType(tag: DW_TAG_structure_type, name: "foo", line: 3, size: 32, align: 32, file: !31, scope: !3, elements: !5)
     29 !3 = !MDFile(filename: "foo.cp", directory: "/tmp/")
     30 !4 = !MDCompileUnit(language: DW_LANG_C_plus_plus, producer: "4.2.1 LLVM build", isOptimized: true, emissionKind: 0, file: !31, enums: !32, retainedTypes: !32, subprograms: !33)
     31 !5 = !{!6, !1, !8}
     32 !6 = !MDDerivedType(tag: DW_TAG_member, name: "y", line: 8, size: 32, align: 32, file: !31, scope: !2, baseType: !7)
     33 !7 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
     34 !8 = !MDSubprogram(name: "baz", linkageName: "_ZN3foo3bazEi", line: 15, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, scopeLine: 15, file: !31, scope: !2, type: !9, function: i32 (%struct.foo*, i32)* @_ZN3foo3bazEi)
     35 !9 = !MDSubroutineType(types: !10)
     36 !10 = !{!7, !11, !7}
     37 !11 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, file: !31, scope: !3, baseType: !2)
     38 !12 = !MDDerivedType(tag: DW_TAG_const_type, size: 64, align: 64, flags: DIFlagArtificial, file: !31, scope: !3, baseType: !13)
     39 !13 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !31, scope: !3, baseType: !2)
     40 !14 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 11, arg: 0, scope: !1, file: !3, type: !7)
     41 !15 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", line: 15, arg: 0, scope: !8, file: !3, type: !12)
     42 !16 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 15, arg: 0, scope: !8, file: !3, type: !7)
     43 !17 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "argc", line: 19, arg: 0, scope: !18, file: !3, type: !7)
     44 !18 = !MDSubprogram(name: "main", linkageName: "main", line: 19, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, scopeLine: 19, file: !31, scope: !3, type: !19)
     45 !19 = !MDSubroutineType(types: !20)
     46 !20 = !{!7, !7, !21}
     47 !21 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !31, scope: !3, baseType: !22)
     48 !22 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !31, scope: !3, baseType: !23)
     49 !23 = !MDBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
     50 !24 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "argv", line: 19, arg: 0, scope: !18, file: !3, type: !21)
     51 !25 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "a", line: 20, scope: !26, file: !3, type: !2)
     52 !26 = distinct !MDLexicalBlock(line: 19, column: 0, file: !31, scope: !27)
     53 !27 = distinct !MDLexicalBlock(line: 19, column: 0, file: !31, scope: !18)
     54 !28 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "b", line: 21, scope: !26, file: !3, type: !7)
     55 !29 = !MDLocation(line: 16, scope: !30)
     56 !30 = distinct !MDLexicalBlock(line: 15, column: 0, file: !31, scope: !8)
     57 !31 = !MDFile(filename: "foo.cp", directory: "/tmp/")
     58 !32 = !{}
     59 !33 = !{!1, !8, !18}
     60 !34 = !{i32 1, !"Debug Info Version", i32 3}
     61