linezero.ll 7.3 KB

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