dbg-loc.ll 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. ; Check that LoopSimplify creates debug locations in synthesized basic blocks.
  2. ; RUN: opt -loop-simplify %s -S -o - | FileCheck %s
  3. %union.anon = type { i32 }
  4. %"Length" = type <{ %union.anon, i8, i8, i8, i8 }>
  5. declare void @bar(%"Length"*) #3
  6. @catchtypeinfo = external unnamed_addr constant { i8*, i8*, i8* }
  7. declare i32 @__gxx_personality_v0(...)
  8. declare void @f1()
  9. declare void @f2()
  10. declare void @f3()
  11. ; CHECK-LABEL: @foo
  12. ; CHECK: for.body.preheader:
  13. ; CHECK-NEXT: br label %for.body, !dbg [[PREHEADER_LOC:![0-9]+]]
  14. ; CHECK: for.end.loopexit:
  15. ; CHECK-NEXT: br label %for.end, !dbg [[LOOPEXIT_LOC:![0-9]+]]
  16. define linkonce_odr hidden void @foo(%"Length"* %begin, %"Length"* %end) nounwind ssp uwtable align 2 {
  17. entry:
  18. %cmp.4 = icmp eq %"Length"* %begin, %end, !dbg !7
  19. br i1 %cmp.4, label %for.end, label %for.body, !dbg !8
  20. for.body: ; preds = %entry, %length.exit
  21. %begin.sink5 = phi %"Length"* [ %incdec.ptr, %length.exit ], [ %begin, %entry ]
  22. %m_type.i.i.i = getelementptr inbounds %"Length", %"Length"* %begin.sink5, i64 0, i32 2, !dbg !9
  23. %0 = load i8, i8* %m_type.i.i.i, align 1, !dbg !9
  24. %cmp.i.i = icmp eq i8 %0, 9, !dbg !7
  25. br i1 %cmp.i.i, label %if.then.i, label %length.exit, !dbg !8
  26. if.then.i: ; preds = %for.body
  27. tail call void @bar(%"Length"* %begin.sink5) #7, !dbg !10
  28. br label %length.exit, !dbg !10
  29. length.exit: ; preds = %for.body, %if.then.i
  30. %incdec.ptr = getelementptr inbounds %"Length", %"Length"* %begin.sink5, i64 1, !dbg !11
  31. %cmp = icmp eq %"Length"* %incdec.ptr, %end, !dbg !7
  32. br i1 %cmp, label %for.end, label %for.body, !dbg !8
  33. for.end: ; preds = %length.exit, %entry
  34. ret void, !dbg !12
  35. }
  36. ; CHECK-LABEL: @with_landingpad
  37. ; CHECK: catch.preheader:
  38. ; CHECK: br label %catch, !dbg [[LPAD_PREHEADER_LOC:![0-9]+]]
  39. ; CHECK: catch.preheader.split-lp:
  40. ; CHECK: br label %catch, !dbg [[LPAD_PREHEADER_LOC]]
  41. define void @with_landingpad() uwtable ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
  42. entry:
  43. invoke void @f1() to label %try.cont19 unwind label %catch, !dbg !13
  44. catch: ; preds = %if.else, %entry
  45. %0 = landingpad { i8*, i32 }
  46. catch i8* bitcast ({ i8*, i8*, i8* }* @catchtypeinfo to i8*), !dbg !13
  47. invoke void @f3() to label %if.else unwind label %eh.resume, !dbg !13
  48. if.else: ; preds = %catch
  49. invoke void @f2() to label %try.cont19 unwind label %catch, !dbg !13
  50. try.cont19: ; preds = %if.else, %entry
  51. ret void, !dbg !13
  52. eh.resume: ; preds = %catch
  53. %1 = landingpad { i8*, i32 }
  54. cleanup catch i8* bitcast ({ i8*, i8*, i8* }* @catchtypeinfo to i8*), !dbg !13
  55. resume { i8*, i32 } undef, !dbg !13
  56. }
  57. ; CHECK-DAG: [[PREHEADER_LOC]] = !DILocation(line: 73, column: 27, scope: !{{[0-9]+}})
  58. ; CHECK-DAG: [[LOOPEXIT_LOC]] = !DILocation(line: 75, column: 9, scope: !{{[0-9]+}})
  59. ; CHECK-DAG: [[LPAD_PREHEADER_LOC]] = !DILocation(line: 85, column: 1, scope: !{{[0-9]+}})
  60. !llvm.module.flags = !{!0, !1, !2}
  61. !0 = !{i32 2, !"Dwarf Version", i32 4}
  62. !1 = !{i32 2, !"Debug Info Version", i32 3}
  63. !2 = !{i32 1, !"PIC Level", i32 2}
  64. !3 = !{}
  65. !4 = !DISubroutineType(types: !3)
  66. !5 = !DIFile(filename: "Vector.h", directory: "/tmp")
  67. !6 = !DISubprogram(name: "destruct", scope: !5, file: !5, line: 71, type: !4, isLocal: false, isDefinition: true, scopeLine: 72, flags: DIFlagPrototyped, isOptimized: false, function: void (%"Length"*, %"Length"*)* @foo, variables: !3)
  68. !7 = !DILocation(line: 73, column: 38, scope: !6)
  69. !8 = !DILocation(line: 73, column: 13, scope: !6)
  70. !9 = !DILocation(line: 73, column: 27, scope: !6)
  71. !10 = !DILocation(line: 74, column: 17, scope: !6)
  72. !11 = !DILocation(line: 73, column: 46, scope: !6)
  73. !12 = !DILocation(line: 75, column: 9, scope: !6)
  74. !13 = !DILocation(line: 85, column: 1, scope: !6)