2009-01-13-RecursiveInlineCrash.ll 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. ; RUN: opt < %s -inline -argpromotion -disable-output
  2. ; ModuleID = '<stdin>'
  3. target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
  4. target triple = "i386-apple-darwin9.6"
  5. %struct.quad_struct = type { i32, i32, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct* }
  6. @NumNodes = external global i32 ; <i32*> [#uses=0]
  7. @"\01LC" = external constant [43 x i8] ; <[43 x i8]*> [#uses=0]
  8. @"\01LC1" = external constant [19 x i8] ; <[19 x i8]*> [#uses=0]
  9. @"\01LC2" = external constant [17 x i8] ; <[17 x i8]*> [#uses=0]
  10. declare i32 @dealwithargs(i32, i8** nocapture) nounwind
  11. declare i32 @atoi(i8*)
  12. define internal fastcc i32 @adj(i32 %d, i32 %ct) nounwind readnone {
  13. entry:
  14. switch i32 %d, label %return [
  15. i32 0, label %bb
  16. i32 1, label %bb10
  17. i32 2, label %bb5
  18. i32 3, label %bb15
  19. ]
  20. bb: ; preds = %entry
  21. switch i32 %ct, label %bb3 [
  22. i32 1, label %return
  23. i32 0, label %return
  24. ]
  25. bb3: ; preds = %bb
  26. ret i32 0
  27. bb5: ; preds = %entry
  28. switch i32 %ct, label %bb8 [
  29. i32 3, label %return
  30. i32 2, label %return
  31. ]
  32. bb8: ; preds = %bb5
  33. ret i32 0
  34. bb10: ; preds = %entry
  35. switch i32 %ct, label %bb13 [
  36. i32 1, label %return
  37. i32 3, label %return
  38. ]
  39. bb13: ; preds = %bb10
  40. ret i32 0
  41. bb15: ; preds = %entry
  42. switch i32 %ct, label %bb18 [
  43. i32 2, label %return
  44. i32 0, label %return
  45. ]
  46. bb18: ; preds = %bb15
  47. ret i32 0
  48. return: ; preds = %bb15, %bb15, %bb10, %bb10, %bb5, %bb5, %bb, %bb, %entry
  49. ret i32 1
  50. }
  51. declare fastcc i32 @reflect(i32, i32) nounwind readnone
  52. declare i32 @CountTree(%struct.quad_struct* nocapture) nounwind readonly
  53. define internal fastcc %struct.quad_struct* @child(%struct.quad_struct* nocapture %tree, i32 %ct) nounwind readonly {
  54. entry:
  55. switch i32 %ct, label %bb5 [
  56. i32 0, label %bb1
  57. i32 1, label %bb
  58. i32 2, label %bb3
  59. i32 3, label %bb2
  60. ]
  61. bb: ; preds = %entry
  62. %0 = getelementptr %struct.quad_struct, %struct.quad_struct* %tree, i32 0, i32 3 ; <%struct.quad_struct**> [#uses=1]
  63. %1 = load %struct.quad_struct*, %struct.quad_struct** %0, align 4 ; <%struct.quad_struct*> [#uses=1]
  64. ret %struct.quad_struct* %1
  65. bb1: ; preds = %entry
  66. %2 = getelementptr %struct.quad_struct, %struct.quad_struct* %tree, i32 0, i32 2 ; <%struct.quad_struct**> [#uses=1]
  67. %3 = load %struct.quad_struct*, %struct.quad_struct** %2, align 4 ; <%struct.quad_struct*> [#uses=1]
  68. ret %struct.quad_struct* %3
  69. bb2: ; preds = %entry
  70. %4 = getelementptr %struct.quad_struct, %struct.quad_struct* %tree, i32 0, i32 5 ; <%struct.quad_struct**> [#uses=1]
  71. %5 = load %struct.quad_struct*, %struct.quad_struct** %4, align 4 ; <%struct.quad_struct*> [#uses=1]
  72. ret %struct.quad_struct* %5
  73. bb3: ; preds = %entry
  74. %6 = getelementptr %struct.quad_struct, %struct.quad_struct* %tree, i32 0, i32 4 ; <%struct.quad_struct**> [#uses=1]
  75. %7 = load %struct.quad_struct*, %struct.quad_struct** %6, align 4 ; <%struct.quad_struct*> [#uses=1]
  76. ret %struct.quad_struct* %7
  77. bb5: ; preds = %entry
  78. ret %struct.quad_struct* null
  79. }
  80. define internal fastcc %struct.quad_struct* @gtequal_adj_neighbor(%struct.quad_struct* nocapture %tree, i32 %d) nounwind readonly {
  81. entry:
  82. %0 = getelementptr %struct.quad_struct, %struct.quad_struct* %tree, i32 0, i32 6 ; <%struct.quad_struct**> [#uses=1]
  83. %1 = load %struct.quad_struct*, %struct.quad_struct** %0, align 4 ; <%struct.quad_struct*> [#uses=4]
  84. %2 = getelementptr %struct.quad_struct, %struct.quad_struct* %tree, i32 0, i32 1 ; <i32*> [#uses=1]
  85. %3 = load i32, i32* %2, align 4 ; <i32> [#uses=2]
  86. %4 = icmp eq %struct.quad_struct* %1, null ; <i1> [#uses=1]
  87. br i1 %4, label %bb3, label %bb
  88. bb: ; preds = %entry
  89. %5 = call fastcc i32 @adj(i32 %d, i32 %3) nounwind ; <i32> [#uses=1]
  90. %6 = icmp eq i32 %5, 0 ; <i1> [#uses=1]
  91. br i1 %6, label %bb3, label %bb1
  92. bb1: ; preds = %bb
  93. %7 = call fastcc %struct.quad_struct* @gtequal_adj_neighbor(%struct.quad_struct* %1, i32 %d) nounwind ; <%struct.quad_struct*> [#uses=1]
  94. br label %bb3
  95. bb3: ; preds = %bb1, %bb, %entry
  96. %q.0 = phi %struct.quad_struct* [ %7, %bb1 ], [ %1, %bb ], [ %1, %entry ] ; <%struct.quad_struct*> [#uses=4]
  97. %8 = icmp eq %struct.quad_struct* %q.0, null ; <i1> [#uses=1]
  98. br i1 %8, label %bb7, label %bb4
  99. bb4: ; preds = %bb3
  100. %9 = getelementptr %struct.quad_struct, %struct.quad_struct* %q.0, i32 0, i32 0 ; <i32*> [#uses=1]
  101. %10 = load i32, i32* %9, align 4 ; <i32> [#uses=1]
  102. %11 = icmp eq i32 %10, 2 ; <i1> [#uses=1]
  103. br i1 %11, label %bb5, label %bb7
  104. bb5: ; preds = %bb4
  105. %12 = call fastcc i32 @reflect(i32 %d, i32 %3) nounwind ; <i32> [#uses=1]
  106. %13 = call fastcc %struct.quad_struct* @child(%struct.quad_struct* %q.0, i32 %12) nounwind ; <%struct.quad_struct*> [#uses=1]
  107. ret %struct.quad_struct* %13
  108. bb7: ; preds = %bb4, %bb3
  109. ret %struct.quad_struct* %q.0
  110. }
  111. declare fastcc i32 @sum_adjacent(%struct.quad_struct* nocapture, i32, i32, i32) nounwind readonly
  112. define i32 @perimeter(%struct.quad_struct* nocapture %tree, i32 %size) nounwind readonly {
  113. entry:
  114. %0 = getelementptr %struct.quad_struct, %struct.quad_struct* %tree, i32 0, i32 0 ; <i32*> [#uses=1]
  115. %1 = load i32, i32* %0, align 4 ; <i32> [#uses=1]
  116. %2 = icmp eq i32 %1, 2 ; <i1> [#uses=1]
  117. br i1 %2, label %bb, label %bb2
  118. bb: ; preds = %entry
  119. %3 = getelementptr %struct.quad_struct, %struct.quad_struct* %tree, i32 0, i32 4 ; <%struct.quad_struct**> [#uses=1]
  120. %4 = load %struct.quad_struct*, %struct.quad_struct** %3, align 4 ; <%struct.quad_struct*> [#uses=1]
  121. %5 = sdiv i32 %size, 2 ; <i32> [#uses=1]
  122. %6 = call i32 @perimeter(%struct.quad_struct* %4, i32 %5) nounwind ; <i32> [#uses=1]
  123. %7 = getelementptr %struct.quad_struct, %struct.quad_struct* %tree, i32 0, i32 5 ; <%struct.quad_struct**> [#uses=1]
  124. %8 = load %struct.quad_struct*, %struct.quad_struct** %7, align 4 ; <%struct.quad_struct*> [#uses=1]
  125. %9 = sdiv i32 %size, 2 ; <i32> [#uses=1]
  126. %10 = call i32 @perimeter(%struct.quad_struct* %8, i32 %9) nounwind ; <i32> [#uses=1]
  127. %11 = add i32 %10, %6 ; <i32> [#uses=1]
  128. %12 = getelementptr %struct.quad_struct, %struct.quad_struct* %tree, i32 0, i32 3 ; <%struct.quad_struct**> [#uses=1]
  129. %13 = load %struct.quad_struct*, %struct.quad_struct** %12, align 4 ; <%struct.quad_struct*> [#uses=1]
  130. %14 = sdiv i32 %size, 2 ; <i32> [#uses=1]
  131. %15 = call i32 @perimeter(%struct.quad_struct* %13, i32 %14) nounwind ; <i32> [#uses=1]
  132. %16 = add i32 %15, %11 ; <i32> [#uses=1]
  133. %17 = getelementptr %struct.quad_struct, %struct.quad_struct* %tree, i32 0, i32 2 ; <%struct.quad_struct**> [#uses=1]
  134. %18 = load %struct.quad_struct*, %struct.quad_struct** %17, align 4 ; <%struct.quad_struct*> [#uses=1]
  135. %19 = sdiv i32 %size, 2 ; <i32> [#uses=1]
  136. %20 = call i32 @perimeter(%struct.quad_struct* %18, i32 %19) nounwind ; <i32> [#uses=1]
  137. %21 = add i32 %20, %16 ; <i32> [#uses=1]
  138. ret i32 %21
  139. bb2: ; preds = %entry
  140. %22 = getelementptr %struct.quad_struct, %struct.quad_struct* %tree, i32 0, i32 0 ; <i32*> [#uses=1]
  141. %23 = load i32, i32* %22, align 4 ; <i32> [#uses=1]
  142. %24 = icmp eq i32 %23, 0 ; <i1> [#uses=1]
  143. br i1 %24, label %bb3, label %bb23
  144. bb3: ; preds = %bb2
  145. %25 = call fastcc %struct.quad_struct* @gtequal_adj_neighbor(%struct.quad_struct* %tree, i32 0) nounwind ; <%struct.quad_struct*> [#uses=4]
  146. %26 = icmp eq %struct.quad_struct* %25, null ; <i1> [#uses=1]
  147. br i1 %26, label %bb8, label %bb4
  148. bb4: ; preds = %bb3
  149. %27 = getelementptr %struct.quad_struct, %struct.quad_struct* %25, i32 0, i32 0 ; <i32*> [#uses=1]
  150. %28 = load i32, i32* %27, align 4 ; <i32> [#uses=1]
  151. %29 = icmp eq i32 %28, 1 ; <i1> [#uses=1]
  152. br i1 %29, label %bb8, label %bb6
  153. bb6: ; preds = %bb4
  154. %30 = getelementptr %struct.quad_struct, %struct.quad_struct* %25, i32 0, i32 0 ; <i32*> [#uses=1]
  155. %31 = load i32, i32* %30, align 4 ; <i32> [#uses=1]
  156. %32 = icmp eq i32 %31, 2 ; <i1> [#uses=1]
  157. br i1 %32, label %bb7, label %bb8
  158. bb7: ; preds = %bb6
  159. %33 = call fastcc i32 @sum_adjacent(%struct.quad_struct* %25, i32 3, i32 2, i32 %size) nounwind ; <i32> [#uses=1]
  160. br label %bb8
  161. bb8: ; preds = %bb7, %bb6, %bb4, %bb3
  162. %retval1.1 = phi i32 [ 0, %bb6 ], [ %33, %bb7 ], [ %size, %bb4 ], [ %size, %bb3 ] ; <i32> [#uses=3]
  163. %34 = call fastcc %struct.quad_struct* @gtequal_adj_neighbor(%struct.quad_struct* %tree, i32 1) nounwind ; <%struct.quad_struct*> [#uses=4]
  164. %35 = icmp eq %struct.quad_struct* %34, null ; <i1> [#uses=1]
  165. br i1 %35, label %bb10, label %bb9
  166. bb9: ; preds = %bb8
  167. %36 = getelementptr %struct.quad_struct, %struct.quad_struct* %34, i32 0, i32 0 ; <i32*> [#uses=1]
  168. %37 = load i32, i32* %36, align 4 ; <i32> [#uses=1]
  169. %38 = icmp eq i32 %37, 1 ; <i1> [#uses=1]
  170. br i1 %38, label %bb10, label %bb11
  171. bb10: ; preds = %bb9, %bb8
  172. %39 = add i32 %retval1.1, %size ; <i32> [#uses=1]
  173. br label %bb13
  174. bb11: ; preds = %bb9
  175. %40 = getelementptr %struct.quad_struct, %struct.quad_struct* %34, i32 0, i32 0 ; <i32*> [#uses=1]
  176. %41 = load i32, i32* %40, align 4 ; <i32> [#uses=1]
  177. %42 = icmp eq i32 %41, 2 ; <i1> [#uses=1]
  178. br i1 %42, label %bb12, label %bb13
  179. bb12: ; preds = %bb11
  180. %43 = call fastcc i32 @sum_adjacent(%struct.quad_struct* %34, i32 2, i32 0, i32 %size) nounwind ; <i32> [#uses=1]
  181. %44 = add i32 %43, %retval1.1 ; <i32> [#uses=1]
  182. br label %bb13
  183. bb13: ; preds = %bb12, %bb11, %bb10
  184. %retval1.2 = phi i32 [ %retval1.1, %bb11 ], [ %44, %bb12 ], [ %39, %bb10 ] ; <i32> [#uses=3]
  185. %45 = call fastcc %struct.quad_struct* @gtequal_adj_neighbor(%struct.quad_struct* %tree, i32 2) nounwind ; <%struct.quad_struct*> [#uses=4]
  186. %46 = icmp eq %struct.quad_struct* %45, null ; <i1> [#uses=1]
  187. br i1 %46, label %bb15, label %bb14
  188. bb14: ; preds = %bb13
  189. %47 = getelementptr %struct.quad_struct, %struct.quad_struct* %45, i32 0, i32 0 ; <i32*> [#uses=1]
  190. %48 = load i32, i32* %47, align 4 ; <i32> [#uses=1]
  191. %49 = icmp eq i32 %48, 1 ; <i1> [#uses=1]
  192. br i1 %49, label %bb15, label %bb16
  193. bb15: ; preds = %bb14, %bb13
  194. %50 = add i32 %retval1.2, %size ; <i32> [#uses=1]
  195. br label %bb18
  196. bb16: ; preds = %bb14
  197. %51 = getelementptr %struct.quad_struct, %struct.quad_struct* %45, i32 0, i32 0 ; <i32*> [#uses=1]
  198. %52 = load i32, i32* %51, align 4 ; <i32> [#uses=1]
  199. %53 = icmp eq i32 %52, 2 ; <i1> [#uses=1]
  200. br i1 %53, label %bb17, label %bb18
  201. bb17: ; preds = %bb16
  202. %54 = call fastcc i32 @sum_adjacent(%struct.quad_struct* %45, i32 0, i32 1, i32 %size) nounwind ; <i32> [#uses=1]
  203. %55 = add i32 %54, %retval1.2 ; <i32> [#uses=1]
  204. br label %bb18
  205. bb18: ; preds = %bb17, %bb16, %bb15
  206. %retval1.3 = phi i32 [ %retval1.2, %bb16 ], [ %55, %bb17 ], [ %50, %bb15 ] ; <i32> [#uses=3]
  207. %56 = call fastcc %struct.quad_struct* @gtequal_adj_neighbor(%struct.quad_struct* %tree, i32 3) nounwind ; <%struct.quad_struct*> [#uses=4]
  208. %57 = icmp eq %struct.quad_struct* %56, null ; <i1> [#uses=1]
  209. br i1 %57, label %bb20, label %bb19
  210. bb19: ; preds = %bb18
  211. %58 = getelementptr %struct.quad_struct, %struct.quad_struct* %56, i32 0, i32 0 ; <i32*> [#uses=1]
  212. %59 = load i32, i32* %58, align 4 ; <i32> [#uses=1]
  213. %60 = icmp eq i32 %59, 1 ; <i1> [#uses=1]
  214. br i1 %60, label %bb20, label %bb21
  215. bb20: ; preds = %bb19, %bb18
  216. %61 = add i32 %retval1.3, %size ; <i32> [#uses=1]
  217. ret i32 %61
  218. bb21: ; preds = %bb19
  219. %62 = getelementptr %struct.quad_struct, %struct.quad_struct* %56, i32 0, i32 0 ; <i32*> [#uses=1]
  220. %63 = load i32, i32* %62, align 4 ; <i32> [#uses=1]
  221. %64 = icmp eq i32 %63, 2 ; <i1> [#uses=1]
  222. br i1 %64, label %bb22, label %bb23
  223. bb22: ; preds = %bb21
  224. %65 = call fastcc i32 @sum_adjacent(%struct.quad_struct* %56, i32 1, i32 3, i32 %size) nounwind ; <i32> [#uses=1]
  225. %66 = add i32 %65, %retval1.3 ; <i32> [#uses=1]
  226. ret i32 %66
  227. bb23: ; preds = %bb21, %bb2
  228. %retval1.0 = phi i32 [ 0, %bb2 ], [ %retval1.3, %bb21 ] ; <i32> [#uses=1]
  229. ret i32 %retval1.0
  230. }
  231. declare i32 @main(i32, i8** nocapture) noreturn nounwind
  232. declare i32 @printf(i8*, ...) nounwind
  233. declare void @exit(i32) noreturn nounwind
  234. declare fastcc i32 @CheckOutside(i32, i32) nounwind readnone
  235. declare fastcc i32 @CheckIntersect(i32, i32, i32) nounwind readnone
  236. declare %struct.quad_struct* @MakeTree(i32, i32, i32, i32, i32, %struct.quad_struct*, i32, i32) nounwind