2009-03-05-dbg.ll 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ; REQUIRES: asserts
  2. ; RUN: opt < %s -globalopt -stats -disable-output 2>&1 | grep "1 globalopt - Number of global vars shrunk to booleans"
  3. @Stop = internal global i32 0 ; <i32*> [#uses=3]
  4. define i32 @foo(i32 %i) nounwind ssp {
  5. entry:
  6. %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
  7. call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !3, metadata !{})
  8. %0 = icmp eq i32 %i, 1, !dbg !7 ; <i1> [#uses=1]
  9. br i1 %0, label %bb, label %bb1, !dbg !7
  10. bb: ; preds = %entry
  11. store i32 0, i32* @Stop, align 4, !dbg !9
  12. %1 = mul nsw i32 %i, 42, !dbg !10 ; <i32> [#uses=1]
  13. call void @llvm.dbg.value(metadata i32 %1, i64 0, metadata !3, metadata !{}), !dbg !10
  14. br label %bb2, !dbg !10
  15. bb1: ; preds = %entry
  16. store i32 1, i32* @Stop, align 4, !dbg !11
  17. br label %bb2, !dbg !11
  18. bb2: ; preds = %bb1, %bb
  19. %i_addr.0 = phi i32 [ %1, %bb ], [ %i, %bb1 ] ; <i32> [#uses=1]
  20. br label %return, !dbg !12
  21. return: ; preds = %bb2
  22. ret i32 %i_addr.0, !dbg !12
  23. }
  24. declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
  25. define i32 @bar() nounwind ssp {
  26. entry:
  27. %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
  28. %0 = load i32, i32* @Stop, align 4, !dbg !13 ; <i32> [#uses=1]
  29. %1 = icmp eq i32 %0, 1, !dbg !13 ; <i1> [#uses=1]
  30. br i1 %1, label %bb, label %bb1, !dbg !13
  31. bb: ; preds = %entry
  32. br label %bb2, !dbg !18
  33. bb1: ; preds = %entry
  34. br label %bb2, !dbg !19
  35. bb2: ; preds = %bb1, %bb
  36. %.0 = phi i32 [ 0, %bb ], [ 1, %bb1 ] ; <i32> [#uses=1]
  37. br label %return, !dbg !19
  38. return: ; preds = %bb2
  39. ret i32 %.0, !dbg !19
  40. }
  41. declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
  42. !llvm.dbg.gv = !{!0}
  43. !0 = !DIGlobalVariable(name: "Stop", line: 2, isLocal: true, isDefinition: true, scope: !1, file: !1, type: !2, variable: i32* @Stop)
  44. !1 = !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: 0, file: !20, enums: !21, retainedTypes: !21)
  45. !2 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
  46. !3 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "i", line: 4, arg: 0, scope: !4, file: !1, type: !2)
  47. !4 = !DISubprogram(name: "foo", linkageName: "foo", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scope: !1, type: !5)
  48. !5 = !DISubroutineType(types: !6)
  49. !6 = !{!2, !2}
  50. !7 = !DILocation(line: 5, scope: !8)
  51. !8 = distinct !DILexicalBlock(line: 0, column: 0, file: !20, scope: !4)
  52. !9 = !DILocation(line: 6, scope: !8)
  53. !10 = !DILocation(line: 7, scope: !8)
  54. !11 = !DILocation(line: 9, scope: !8)
  55. !12 = !DILocation(line: 11, scope: !8)
  56. !13 = !DILocation(line: 14, scope: !14)
  57. !14 = distinct !DILexicalBlock(line: 0, column: 0, file: !20, scope: !15)
  58. !15 = !DISubprogram(name: "bar", linkageName: "bar", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scope: !1, type: !16)
  59. !16 = !DISubroutineType(types: !17)
  60. !17 = !{!2}
  61. !18 = !DILocation(line: 15, scope: !14)
  62. !19 = !DILocation(line: 16, scope: !14)
  63. !20 = !DIFile(filename: "g.c", directory: "/tmp")
  64. !21 = !{i32 0}