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