DebugInfo: Move new hierarchy into place
[oota-llvm.git] / test / Transforms / GCOVProfiling / linezero.ll
1 ; RUN: sed -e 's|PATTERN|%/T|g' < %s > %t1
2 ; RUN: opt -insert-gcov-profiling -disable-output < %t1
3 ; RUN: rm %T/linezero.gcno %t1
4
5 ; This is a crash test.
6
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-unknown-linux-gnu"
9
10 %struct.vector = type { i8 }
11
12 ; Function Attrs: nounwind
13 define i32 @_Z4testv() #0 {
14 entry:
15   %retval = alloca i32, align 4
16   %__range = alloca %struct.vector*, align 8
17   %ref.tmp = alloca %struct.vector, align 1
18   %undef.agg.tmp = alloca %struct.vector, align 1
19   %__begin = alloca i8*, align 8
20   %__end = alloca i8*, align 8
21   %spec = alloca i8, align 1
22   call void @llvm.dbg.declare(metadata %struct.vector** %__range, metadata !27, metadata !{}), !dbg !30
23   br label %0
24
25 ; <label>:0                                       ; preds = %entry
26   call void @_Z13TagFieldSpecsv(), !dbg !31
27   store %struct.vector* %ref.tmp, %struct.vector** %__range, align 8, !dbg !31
28   call void @llvm.dbg.declare(metadata i8** %__begin, metadata !32, metadata !{}), !dbg !30
29   %1 = load %struct.vector*, %struct.vector** %__range, align 8, !dbg !31
30   %call = call i8* @_ZN6vector5beginEv(%struct.vector* %1), !dbg !31
31   store i8* %call, i8** %__begin, align 8, !dbg !31
32   call void @llvm.dbg.declare(metadata i8** %__end, metadata !33, metadata !{}), !dbg !30
33   %2 = load %struct.vector*, %struct.vector** %__range, align 8, !dbg !31
34   %call1 = call i8* @_ZN6vector3endEv(%struct.vector* %2), !dbg !31
35   store i8* %call1, i8** %__end, align 8, !dbg !31
36   br label %for.cond, !dbg !31
37
38 for.cond:                                         ; preds = %for.inc, %0
39   %3 = load i8*, i8** %__begin, align 8, !dbg !34
40   %4 = load i8*, i8** %__end, align 8, !dbg !34
41   %cmp = icmp ne i8* %3, %4, !dbg !34
42   br i1 %cmp, label %for.body, label %for.end, !dbg !34
43
44 for.body:                                         ; preds = %for.cond
45   call void @llvm.dbg.declare(metadata i8* %spec, metadata !37, metadata !{}), !dbg !31
46   %5 = load i8*, i8** %__begin, align 8, !dbg !38
47   %6 = load i8, i8* %5, align 1, !dbg !38
48   store i8 %6, i8* %spec, align 1, !dbg !38
49   br label %for.inc, !dbg !38
50
51 for.inc:                                          ; preds = %for.body
52   %7 = load i8*, i8** %__begin, align 8, !dbg !40
53   %incdec.ptr = getelementptr inbounds i8, i8* %7, i32 1, !dbg !40
54   store i8* %incdec.ptr, i8** %__begin, align 8, !dbg !40
55   br label %for.cond, !dbg !40
56
57 for.end:                                          ; preds = %for.cond
58   call void @llvm.trap(), !dbg !42
59   unreachable, !dbg !42
60
61 return:                                           ; No predecessors!
62   %8 = load i32, i32* %retval, !dbg !44
63   ret i32 %8, !dbg !44
64 }
65
66 ; Function Attrs: nounwind readnone
67 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
68
69 declare void @_Z13TagFieldSpecsv() #2
70
71 declare i8* @_ZN6vector5beginEv(%struct.vector*) #2
72
73 declare i8* @_ZN6vector3endEv(%struct.vector*) #2
74
75 ; Function Attrs: noreturn nounwind
76 declare void @llvm.trap() #3
77
78 ; Function Attrs: nounwind
79 define void @_Z2f1v() #0 {
80 entry:
81   br label %0
82
83 ; <label>:0                                       ; preds = %entry
84   ret void, !dbg !45
85 }
86
87 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" }
88 attributes #1 = { nounwind readnone }
89 attributes #2 = { "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" }
90 attributes #3 = { noreturn nounwind }
91
92 !llvm.dbg.cu = !{!0}
93 !llvm.module.flags = !{!23, !24}
94 !llvm.gcov = !{!25}
95 !llvm.ident = !{!26}
96
97 !0 = !MDCompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (trunk 209871)", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !2, imports: !2)
98 !1 = !MDFile(filename: "<stdin>", directory: "PATTERN")
99 !2 = !{}
100 !3 = !{!4}
101 !4 = !MDCompositeType(tag: DW_TAG_structure_type, name: "vector", line: 21, size: 8, align: 8, file: !5, elements: !6, identifier: "_ZTS6vector")
102 !5 = !MDFile(filename: "linezero.cc", directory: "PATTERN")
103 !6 = !{!7, !13}
104 !7 = !MDSubprogram(name: "begin", linkageName: "_ZN6vector5beginEv", line: 25, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 25, file: !5, scope: !"_ZTS6vector", type: !8)
105 !8 = !MDSubroutineType(types: !9)
106 !9 = !{!10, !12}
107 !10 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !11)
108 !11 = !MDBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
109 !12 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS6vector")
110 !13 = !MDSubprogram(name: "end", linkageName: "_ZN6vector3endEv", line: 26, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 26, file: !5, scope: !"_ZTS6vector", type: !8)
111 !14 = !{!15, !20}
112 !15 = !MDSubprogram(name: "test", linkageName: "_Z4testv", line: 50, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 50, file: !5, scope: !16, type: !17, function: i32 ()* @_Z4testv, variables: !2)
113 !16 = !MDFile(filename: "linezero.cc", directory: "PATTERN")
114 !17 = !MDSubroutineType(types: !18)
115 !18 = !{!19}
116 !19 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
117 !20 = !MDSubprogram(name: "f1", linkageName: "_Z2f1v", line: 54, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 54, file: !5, scope: !16, type: !21, function: void ()* @_Z2f1v, variables: !2)
118 !21 = !MDSubroutineType(types: !22)
119 !22 = !{null}
120 !23 = !{i32 2, !"Dwarf Version", i32 4}
121 !24 = !{i32 2, !"Debug Info Version", i32 3}
122 !25 = !{!"PATTERN/linezero.o", !0}
123 !26 = !{!"clang version 3.5.0 (trunk 209871)"}
124 !27 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "__range", flags: DIFlagArtificial, scope: !28, type: !29)
125 !28 = distinct !MDLexicalBlock(line: 51, column: 0, file: !5, scope: !15)
126 !29 = !MDDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: !"_ZTS6vector")
127 !30 = !MDLocation(line: 0, scope: !28)
128 !31 = !MDLocation(line: 51, scope: !28)
129 !32 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "__begin", flags: DIFlagArtificial, scope: !28, type: !10)
130 !33 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "__end", flags: DIFlagArtificial, scope: !28, type: !10)
131 !34 = !MDLocation(line: 51, scope: !35)
132 !35 = distinct !MDLexicalBlock(line: 51, column: 0, file: !5, scope: !36)
133 !36 = distinct !MDLexicalBlock(line: 51, column: 0, file: !5, scope: !28)
134 !37 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "spec", line: 51, scope: !28, file: !16, type: !11)
135 !38 = !MDLocation(line: 51, scope: !39)
136 !39 = distinct !MDLexicalBlock(line: 51, column: 0, file: !5, scope: !28)
137 !40 = !MDLocation(line: 51, scope: !41)
138 !41 = distinct !MDLexicalBlock(line: 51, column: 0, file: !5, scope: !28)
139 !42 = !MDLocation(line: 51, scope: !43)
140 !43 = distinct !MDLexicalBlock(line: 51, column: 0, file: !5, scope: !28)
141 !44 = !MDLocation(line: 52, scope: !15)
142 !45 = !MDLocation(line: 54, scope: !20)