2012-01-16-nopreheader.ll 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ; RUN: opt -loop-reduce -S < %s | FileCheck %s
  2. ;
  3. ; <rdar://10701050> "Cannot split an edge from an IndirectBrInst" assert.
  4. target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
  5. target triple = "x86_64-apple-darwin10.0.0"
  6. ; while.cond197 is a dominates the simplified loop while.cond238 but
  7. ; has no with no preheader.
  8. ;
  9. ; CHECK-LABEL: @nopreheader(
  10. ; CHECK: %while.cond238
  11. ; CHECK: phi i64
  12. ; CHECK-NOT: phi
  13. ; CHECK: indirectbr
  14. define void @nopreheader(i8* %end) nounwind {
  15. entry:
  16. br label %while.cond179
  17. while.cond179: ; preds = %if.end434, %if.end369, %if.end277, %if.end165
  18. %s.1 = phi i8* [ undef, %if.end434 ], [ %incdec.ptr356, %if.end348 ], [ undef, %entry ]
  19. indirectbr i8* undef, [label %land.rhs184, label %while.end453]
  20. land.rhs184: ; preds = %while.cond179
  21. indirectbr i8* undef, [label %while.end453, label %while.cond197]
  22. while.cond197: ; preds = %land.rhs202, %land.rhs184
  23. %0 = phi i64 [ %indvar.next11, %land.rhs202 ], [ 0, %land.rhs184 ]
  24. indirectbr i8* undef, [label %land.rhs202, label %while.end215]
  25. land.rhs202: ; preds = %while.cond197
  26. %indvar.next11 = add i64 %0, 1
  27. indirectbr i8* undef, [label %while.end215, label %while.cond197]
  28. while.end215: ; preds = %land.rhs202, %while.cond197
  29. indirectbr i8* undef, [label %PREMATURE, label %if.end221]
  30. if.end221: ; preds = %while.end215
  31. indirectbr i8* undef, [label %while.cond238.preheader, label %lor.lhs.false227]
  32. lor.lhs.false227: ; preds = %if.end221
  33. indirectbr i8* undef, [label %while.cond238.preheader, label %if.else]
  34. while.cond238.preheader: ; preds = %lor.lhs.false227, %if.end221
  35. %tmp16 = add i64 %0, 2
  36. indirectbr i8* undef, [label %while.cond238]
  37. while.cond238: ; preds = %land.rhs243, %while.cond238.preheader
  38. %1 = phi i64 [ %indvar.next15, %land.rhs243 ], [ 0, %while.cond238.preheader ]
  39. %tmp36 = add i64 %tmp16, %1
  40. %s.3 = getelementptr i8, i8* %s.1, i64 %tmp36
  41. %cmp241 = icmp ult i8* %s.3, %end
  42. indirectbr i8* undef, [label %land.rhs243, label %while.end256]
  43. land.rhs243: ; preds = %while.cond238
  44. %indvar.next15 = add i64 %1, 1
  45. indirectbr i8* undef, [label %while.end256, label %while.cond238]
  46. while.end256: ; preds = %land.rhs243, %while.cond238
  47. indirectbr i8* undef, [label %PREMATURE]
  48. if.else: ; preds = %lor.lhs.false227
  49. indirectbr i8* undef, [label %if.then297, label %if.else386]
  50. if.then297: ; preds = %if.else
  51. indirectbr i8* undef, [label %PREMATURE, label %if.end307]
  52. if.end307: ; preds = %if.then297
  53. indirectbr i8* undef, [label %if.end314, label %FAIL]
  54. if.end314: ; preds = %if.end307
  55. indirectbr i8* undef, [label %if.end340]
  56. if.end340: ; preds = %while.end334
  57. indirectbr i8* undef, [label %PREMATURE, label %if.end348]
  58. if.end348: ; preds = %if.end340
  59. %incdec.ptr356 = getelementptr inbounds i8, i8* undef, i64 2
  60. indirectbr i8* undef, [label %while.cond179]
  61. if.else386: ; preds = %if.else
  62. indirectbr i8* undef, [label %while.end453, label %if.end434]
  63. if.end434: ; preds = %if.then428, %if.end421
  64. indirectbr i8* undef, [label %while.cond179]
  65. while.end453: ; preds = %if.else386, %land.rhs184, %while.cond179
  66. indirectbr i8* undef, [label %PREMATURE, label %if.end459]
  67. if.end459: ; preds = %while.end453
  68. indirectbr i8* undef, [label %if.then465, label %FAIL]
  69. if.then465: ; preds = %if.end459
  70. indirectbr i8* undef, [label %return, label %if.then479]
  71. if.then479: ; preds = %if.then465
  72. indirectbr i8* undef, [label %return]
  73. FAIL: ; preds = %if.end459, %if.end307, %land.lhs.true142, %land.lhs.true131, %while.end
  74. indirectbr i8* undef, [label %DECL_FAIL]
  75. PREMATURE: ; preds = %while.end453, %while.end415, %if.end340, %while.end334, %if.then297, %while.end256, %while.end215
  76. indirectbr i8* undef, [label %return, label %if.then495]
  77. if.then495: ; preds = %PREMATURE
  78. indirectbr i8* undef, [label %return]
  79. DECL_FAIL: ; preds = %if.then488, %FAIL, %land.lhs.true99, %lor.lhs.false, %if.end83, %if.then39, %if.end
  80. indirectbr i8* undef, [label %return]
  81. return: ; preds = %if.then512, %if.end504, %DECL_FAIL, %if.then495, %PREMATURE, %if.then479, %if.then465, %if.then69, %if.end52, %if.end19, %if.then
  82. ret void
  83. }