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