iterative-simplify.ll 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. ; RUN: opt < %s -simplifycfg -S | not grep bb17
  2. ; PR1786
  3. define i32 @main() {
  4. entry:
  5. %retval = alloca i32, align 4 ; <i32*> [#uses=1]
  6. %i = alloca i32, align 4 ; <i32*> [#uses=7]
  7. %z = alloca i32, align 4 ; <i32*> [#uses=4]
  8. %z16 = alloca i32, align 4 ; <i32*> [#uses=4]
  9. %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
  10. store i32 0, i32* %i
  11. %toBool = icmp ne i8 1, 0 ; <i1> [#uses=1]
  12. br i1 %toBool, label %cond_true, label %cond_false
  13. cond_true: ; preds = %entry
  14. store i32 0, i32* %z
  15. br label %bb
  16. bb: ; preds = %cond_next, %cond_true
  17. %tmp = load i32, i32* %z ; <i32> [#uses=1]
  18. %tmp1 = sub i32 %tmp, 16384 ; <i32> [#uses=1]
  19. store i32 %tmp1, i32* %z
  20. %tmp2 = load i32, i32* %i ; <i32> [#uses=1]
  21. %tmp3 = add i32 %tmp2, 1 ; <i32> [#uses=1]
  22. store i32 %tmp3, i32* %i
  23. %tmp4 = load i32, i32* %i ; <i32> [#uses=1]
  24. %tmp5 = icmp sgt i32 %tmp4, 262144 ; <i1> [#uses=1]
  25. %tmp56 = zext i1 %tmp5 to i8 ; <i8> [#uses=1]
  26. %toBool7 = icmp ne i8 %tmp56, 0 ; <i1> [#uses=1]
  27. br i1 %toBool7, label %cond_true8, label %cond_next
  28. cond_true8: ; preds = %bb
  29. call void @abort( )
  30. unreachable
  31. cond_next: ; preds = %bb
  32. %tmp9 = load i32, i32* %z ; <i32> [#uses=1]
  33. %tmp10 = icmp ne i32 %tmp9, 0 ; <i1> [#uses=1]
  34. %tmp1011 = zext i1 %tmp10 to i8 ; <i8> [#uses=1]
  35. %toBool12 = icmp ne i8 %tmp1011, 0 ; <i1> [#uses=1]
  36. br i1 %toBool12, label %bb, label %bb13
  37. bb13: ; preds = %cond_next
  38. call void @exit( i32 0 )
  39. unreachable
  40. cond_false: ; preds = %entry
  41. %toBool14 = icmp ne i8 1, 0 ; <i1> [#uses=1]
  42. br i1 %toBool14, label %cond_true15, label %cond_false33
  43. cond_true15: ; preds = %cond_false
  44. store i32 0, i32* %z16
  45. br label %bb17
  46. bb17: ; preds = %cond_next27, %cond_true15
  47. %tmp18 = load i32, i32* %z16 ; <i32> [#uses=1]
  48. %tmp19 = sub i32 %tmp18, 16384 ; <i32> [#uses=1]
  49. store i32 %tmp19, i32* %z16
  50. %tmp20 = load i32, i32* %i ; <i32> [#uses=1]
  51. %tmp21 = add i32 %tmp20, 1 ; <i32> [#uses=1]
  52. store i32 %tmp21, i32* %i
  53. %tmp22 = load i32, i32* %i ; <i32> [#uses=1]
  54. %tmp23 = icmp sgt i32 %tmp22, 262144 ; <i1> [#uses=1]
  55. %tmp2324 = zext i1 %tmp23 to i8 ; <i8> [#uses=1]
  56. %toBool25 = icmp ne i8 %tmp2324, 0 ; <i1> [#uses=1]
  57. br i1 %toBool25, label %cond_true26, label %cond_next27
  58. cond_true26: ; preds = %bb17
  59. call void @abort( )
  60. unreachable
  61. cond_next27: ; preds = %bb17
  62. %tmp28 = load i32, i32* %z16 ; <i32> [#uses=1]
  63. %tmp29 = icmp ne i32 %tmp28, 0 ; <i1> [#uses=1]
  64. %tmp2930 = zext i1 %tmp29 to i8 ; <i8> [#uses=1]
  65. %toBool31 = icmp ne i8 %tmp2930, 0 ; <i1> [#uses=1]
  66. br i1 %toBool31, label %bb17, label %bb32
  67. bb32: ; preds = %cond_next27
  68. call void @exit( i32 0 )
  69. unreachable
  70. cond_false33: ; preds = %cond_false
  71. call void @exit( i32 0 )
  72. unreachable
  73. cond_next34: ; No predecessors!
  74. br label %cond_next35
  75. cond_next35: ; preds = %cond_next34
  76. br label %return
  77. return: ; preds = %cond_next35
  78. %retval36 = load i32, i32* %retval ; <i32> [#uses=1]
  79. ret i32 %retval36
  80. }
  81. declare void @abort()
  82. declare void @exit(i32)