dbgvalue.ll 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. ; RUN: opt -S -loop-rotate < %s | FileCheck %s
  2. declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
  3. declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
  4. define i32 @tak(i32 %x, i32 %y, i32 %z) nounwind ssp {
  5. ; CHECK-LABEL: define i32 @tak(
  6. ; CHECK: entry
  7. ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %x
  8. entry:
  9. br label %tailrecurse
  10. tailrecurse: ; preds = %if.then, %entry
  11. %x.tr = phi i32 [ %x, %entry ], [ %call, %if.then ]
  12. %y.tr = phi i32 [ %y, %entry ], [ %call9, %if.then ]
  13. %z.tr = phi i32 [ %z, %entry ], [ %call14, %if.then ]
  14. tail call void @llvm.dbg.value(metadata i32 %x.tr, i64 0, metadata !6, metadata !DIExpression()), !dbg !7
  15. tail call void @llvm.dbg.value(metadata i32 %y.tr, i64 0, metadata !8, metadata !DIExpression()), !dbg !9
  16. tail call void @llvm.dbg.value(metadata i32 %z.tr, i64 0, metadata !10, metadata !DIExpression()), !dbg !11
  17. %cmp = icmp slt i32 %y.tr, %x.tr, !dbg !12
  18. br i1 %cmp, label %if.then, label %if.end, !dbg !12
  19. if.then: ; preds = %tailrecurse
  20. %sub = sub nsw i32 %x.tr, 1, !dbg !14
  21. %call = tail call i32 @tak(i32 %sub, i32 %y.tr, i32 %z.tr), !dbg !14
  22. %sub6 = sub nsw i32 %y.tr, 1, !dbg !14
  23. %call9 = tail call i32 @tak(i32 %sub6, i32 %z.tr, i32 %x.tr), !dbg !14
  24. %sub11 = sub nsw i32 %z.tr, 1, !dbg !14
  25. %call14 = tail call i32 @tak(i32 %sub11, i32 %x.tr, i32 %y.tr), !dbg !14
  26. br label %tailrecurse
  27. if.end: ; preds = %tailrecurse
  28. br label %return, !dbg !16
  29. return: ; preds = %if.end
  30. ret i32 %z.tr, !dbg !17
  31. }
  32. @channelColumns = external global i64
  33. @horzPlane = external global i8*, align 8
  34. define void @FindFreeHorzSeg(i64 %startCol, i64 %row, i64* %rowStart) {
  35. ; Ensure that the loop increment basic block is rotated into the tail of the
  36. ; body, even though it contains a debug intrinsic call.
  37. ; CHECK-LABEL: define void @FindFreeHorzSeg(
  38. ; CHECK: %dec = add
  39. ; CHECK-NEXT: tail call void @llvm.dbg.value
  40. ; CHECK: %cmp = icmp
  41. ; CHECK: br i1 %cmp
  42. ; CHECK: phi i64 [ %{{[^,]*}}, %{{[^,]*}} ]
  43. ; CHECK-NEXT: br label %for.end
  44. entry:
  45. br label %for.cond
  46. for.cond:
  47. %i.0 = phi i64 [ %startCol, %entry ], [ %dec, %for.inc ]
  48. %cmp = icmp eq i64 %i.0, 0
  49. br i1 %cmp, label %for.end, label %for.body
  50. for.body:
  51. %0 = load i64, i64* @channelColumns, align 8
  52. %mul = mul i64 %0, %row
  53. %add = add i64 %mul, %i.0
  54. %1 = load i8*, i8** @horzPlane, align 8
  55. %arrayidx = getelementptr inbounds i8, i8* %1, i64 %add
  56. %2 = load i8, i8* %arrayidx, align 1
  57. %tobool = icmp eq i8 %2, 0
  58. br i1 %tobool, label %for.inc, label %for.end
  59. for.inc:
  60. %dec = add i64 %i.0, -1
  61. tail call void @llvm.dbg.value(metadata i64 %dec, i64 0, metadata !DILocalVariable(tag: DW_TAG_auto_variable, scope: !0), metadata !DIExpression()), !dbg !DILocation(scope: !0)
  62. br label %for.cond
  63. for.end:
  64. %add1 = add i64 %i.0, 1
  65. store i64 %add1, i64* %rowStart, align 8
  66. ret void
  67. }
  68. !llvm.module.flags = !{!20}
  69. !llvm.dbg.sp = !{!0}
  70. !0 = !DISubprogram(name: "tak", line: 32, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !18, scope: !1, type: !3, function: i32 (i32, i32, i32)* @tak)
  71. !1 = !DIFile(filename: "/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", directory: "/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame")
  72. !2 = !DICompileUnit(language: DW_LANG_C99, producer: "clang version 2.9 (trunk 125492)", isOptimized: true, emissionKind: 0, file: !18, enums: !19, retainedTypes: !19)
  73. !3 = !DISubroutineType(types: !4)
  74. !4 = !{!5}
  75. !5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
  76. !6 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 32, arg: 0, scope: !0, file: !1, type: !5)
  77. !7 = !DILocation(line: 32, column: 13, scope: !0)
  78. !8 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "y", line: 32, arg: 0, scope: !0, file: !1, type: !5)
  79. !9 = !DILocation(line: 32, column: 20, scope: !0)
  80. !10 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "z", line: 32, arg: 0, scope: !0, file: !1, type: !5)
  81. !11 = !DILocation(line: 32, column: 27, scope: !0)
  82. !12 = !DILocation(line: 33, column: 3, scope: !13)
  83. !13 = distinct !DILexicalBlock(line: 32, column: 30, file: !18, scope: !0)
  84. !14 = !DILocation(line: 34, column: 5, scope: !15)
  85. !15 = distinct !DILexicalBlock(line: 33, column: 14, file: !18, scope: !13)
  86. !16 = !DILocation(line: 36, column: 3, scope: !13)
  87. !17 = !DILocation(line: 37, column: 1, scope: !13)
  88. !18 = !DIFile(filename: "/Volumes/Lalgate/cj/llvm/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame/recursive.c", directory: "/Volumes/Lalgate/cj/D/projects/llvm-test/SingleSource/Benchmarks/BenchmarkGame")
  89. !19 = !{i32 0}
  90. !20 = !{i32 1, !"Debug Info Version", i32 3}