Home | History | Annotate | Download | only in Generic
      1 ; REQUIRES: object-emission
      2 
      3 ; For some reason, the output when targetting sparc is not quite as expected.
      4 ; XFAIL: sparc
      5 
      6 ; RUN: %llc_dwarf -O0 -filetype=obj -dwarf-linkage-names=All < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
      7 
      8 ; IR generated from clang -O0 with:
      9 ; struct C {
     10 ;   ~C();
     11 ; };
     12 ; extern bool b;
     13 ; void fun4() { b && (C(), 1); }
     14 ; __attribute__((always_inline)) C::~C() { }
     15 
     16 ; CHECK: DW_TAG_structure_type
     17 ; CHECK-NOT: DW_TAG
     18 ; CHECK:   DW_AT_name {{.*}} "C"
     19 ; CHECK-NOT: {{DW_TAG|NULL}}
     20 ; CHECK:   DW_TAG_subprogram
     21 ; CHECK-NOT: DW_TAG
     22 ; CHECK:     DW_AT_name {{.*}} "~C"
     23 
     24 ; CHECK:  DW_TAG_subprogram
     25 ; CHECK-NOT: DW_TAG
     26 ; CHECK:   DW_AT_linkage_name {{.*}} "_ZN1CD1Ev"
     27 ; CHECK-NOT: {{DW_TAG|NULL}}
     28 ; CHECK:  DW_TAG_formal_parameter
     29 ; CHECK-NOT: DW_TAG
     30 ; CHECK:     DW_AT_name {{.*}} "this"
     31 
     32 ; CHECK: DW_TAG_subprogram
     33 ; CHECK-NOT: DW_TAG
     34 ; CHECK:   DW_AT_name {{.*}} "fun4"
     35 ; CHECK-NOT: {{DW_TAG|NULL}}
     36 ; CHECK:   DW_TAG_inlined_subroutine
     37 ; CHECK-NOT: DW_TAG
     38 ; CHECK:     DW_AT_abstract_origin {{.*}} "_ZN1CD1Ev"
     39 ; CHECK-NOT: {{DW_TAG|NULL}}
     40 ; CHECK:     DW_TAG_formal_parameter
     41 ; CHECK-NOT: DW_TAG
     42 ; CHECK:       DW_AT_abstract_origin {{.*}} "this"
     43 
     44 ; FIXME: D2 is actually inlined into D1 but doesn't show up here, possibly due
     45 ; to there being no work in D2 (calling another member function from the dtor
     46 ; causes D2 to show up, calling a free function doesn't).
     47 
     48 ; CHECK-NOT: DW_TAG
     49 ; CHECK:     NULL
     50 ; CHECK-NOT: DW_TAG
     51 ; CHECK:   NULL
     52 
     53 %struct.C = type { i8 }
     54 
     55 @b = external global i8
     56 
     57 ; Function Attrs: nounwind
     58 define void @_Z4fun4v() #0 !dbg !12 {
     59 entry:
     60   %this.addr.i.i = alloca %struct.C*, align 8, !dbg !21
     61   %this.addr.i = alloca %struct.C*, align 8, !dbg !22
     62   %agg.tmp.ensured = alloca %struct.C, align 1
     63   %cleanup.cond = alloca i1
     64   %0 = load i8, i8* @b, align 1, !dbg !24
     65   %tobool = trunc i8 %0 to i1, !dbg !24
     66   store i1 false, i1* %cleanup.cond
     67   br i1 %tobool, label %land.rhs, label %land.end, !dbg !24
     68 
     69 land.rhs:                                         ; preds = %entry
     70   store i1 true, i1* %cleanup.cond, !dbg !25
     71   br label %land.end
     72 
     73 land.end:                                         ; preds = %land.rhs, %entry
     74   %1 = phi i1 [ false, %entry ], [ true, %land.rhs ]
     75   %cleanup.is_active = load i1, i1* %cleanup.cond, !dbg !27
     76   br i1 %cleanup.is_active, label %cleanup.action, label %cleanup.done, !dbg !27
     77 
     78 cleanup.action:                                   ; preds = %land.end
     79   store %struct.C* %agg.tmp.ensured, %struct.C** %this.addr.i, align 8, !dbg !22
     80   call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !129, metadata !DIExpression()), !dbg !31
     81   %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !22
     82   store %struct.C* %this1.i, %struct.C** %this.addr.i.i, align 8, !dbg !21
     83   call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i.i, metadata !132, metadata !DIExpression()), !dbg !33
     84   %this1.i.i = load %struct.C*, %struct.C** %this.addr.i.i, !dbg !21
     85   br label %cleanup.done, !dbg !22
     86 
     87 cleanup.done:                                     ; preds = %cleanup.action, %land.end
     88   ret void, !dbg !34
     89 }
     90 
     91 ; Function Attrs: alwaysinline nounwind
     92 define void @_ZN1CD1Ev(%struct.C* %this) unnamed_addr #1 align 2 !dbg !17 {
     93 entry:
     94   %this.addr.i = alloca %struct.C*, align 8, !dbg !37
     95   %this.addr = alloca %struct.C*, align 8
     96   store %struct.C* %this, %struct.C** %this.addr, align 8
     97   call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !29, metadata !DIExpression()), !dbg !38
     98   %this1 = load %struct.C*, %struct.C** %this.addr
     99   store %struct.C* %this1, %struct.C** %this.addr.i, align 8, !dbg !37
    100   call void @llvm.dbg.declare(metadata %struct.C** %this.addr.i, metadata !232, metadata !DIExpression()), !dbg !39
    101   %this1.i = load %struct.C*, %struct.C** %this.addr.i, !dbg !37
    102   ret void, !dbg !37
    103 }
    104 
    105 ; Function Attrs: alwaysinline nounwind
    106 define void @_ZN1CD2Ev(%struct.C* %this) unnamed_addr #1 align 2 !dbg !16 {
    107 entry:
    108   %this.addr = alloca %struct.C*, align 8
    109   store %struct.C* %this, %struct.C** %this.addr, align 8
    110   call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !32, metadata !DIExpression()), !dbg !40
    111   %this1 = load %struct.C*, %struct.C** %this.addr
    112   ret void, !dbg !41
    113 }
    114 
    115 ; Function Attrs: nounwind readnone
    116 declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
    117 
    118 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
    119 attributes #1 = { alwaysinline nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
    120 attributes #2 = { nounwind readnone }
    121 
    122 !llvm.dbg.cu = !{!0}
    123 !llvm.module.flags = !{!18, !19}
    124 !llvm.ident = !{!20}
    125 
    126 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2)
    127 !1 = !DIFile(filename: "<stdin>", directory: "/tmp/dbginfo")
    128 !2 = !{}
    129 !3 = !{!4}
    130 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !5, elements: !6, identifier: "_ZTS1C")
    131 !5 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo")
    132 !6 = !{!7}
    133 !7 = !DISubprogram(name: "~C", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !4, type: !8)
    134 !8 = !DISubroutineType(types: !9)
    135 !9 = !{null, !10}
    136 !10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
    137 !12 = distinct !DISubprogram(name: "fun4", linkageName: "_Z4fun4v", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 5, file: !5, scope: !13, type: !14, variables: !2)
    138 !13 = !DIFile(filename: "PR20038.cpp", directory: "/tmp/dbginfo")
    139 !14 = !DISubroutineType(types: !15)
    140 !15 = !{null}
    141 !16 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD2Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !5, scope: !4, type: !8, declaration: !7, variables: !2)
    142 !17 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD1Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !5, scope: !4, type: !8, declaration: !7, variables: !2)
    143 !18 = !{i32 2, !"Dwarf Version", i32 4}
    144 !19 = !{i32 2, !"Debug Info Version", i32 3}
    145 !20 = !{!"clang version 3.5.0 "}
    146 !21 = !DILocation(line: 6, scope: !17, inlinedAt: !22)
    147 !22 = !DILocation(line: 5, scope: !23)
    148 !23 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
    149 !24 = !DILocation(line: 5, scope: !12)
    150 !25 = !DILocation(line: 5, scope: !26)
    151 !26 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
    152 !27 = !DILocation(line: 5, scope: !28)
    153 !28 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
    154 !29 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30)
    155 !30 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4)
    156 !31 = !DILocation(line: 0, scope: !17, inlinedAt: !22)
    157 !32 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
    158 !33 = !DILocation(line: 0, scope: !16, inlinedAt: !21)
    159 
    160 !129 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !30)
    161 !132 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
    162 !232 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !16, type: !30)
    163 
    164 !34 = !DILocation(line: 5, scope: !35)
    165 !35 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !36)
    166 !36 = distinct !DILexicalBlock(line: 5, column: 0, file: !5, scope: !12)
    167 !37 = !DILocation(line: 6, scope: !17)
    168 !38 = !DILocation(line: 0, scope: !17)
    169 !39 = !DILocation(line: 0, scope: !16, inlinedAt: !37)
    170 !40 = !DILocation(line: 0, scope: !16)
    171 !41 = !DILocation(line: 6, scope: !16)
    172