crash.ll 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. ; RUN: opt -scalarrepl -disable-output < %s
  2. ; RUN: opt -scalarrepl-ssa -disable-output < %s
  3. 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"
  4. target triple = "x86_64-apple-darwin10.0.0"
  5. ; PR9017
  6. define void @test1() nounwind readnone ssp {
  7. entry:
  8. %l_72 = alloca i32*, align 8
  9. unreachable
  10. for.cond: ; preds = %for.cond
  11. %tmp1.i = load i32*, i32** %l_72, align 8
  12. store i32* %tmp1.i, i32** %l_72, align 8
  13. br label %for.cond
  14. if.end: ; No predecessors!
  15. ret void
  16. }
  17. define void @test2() {
  18. %E = alloca { { i32, float, double, i64 }, { i32, float, double, i64 } } ; <{ { i32, float, double, i64 }, { i32, float, double, i64 } }*> [#uses=1]
  19. %tmp.151 = getelementptr { { i32, float, double, i64 }, { i32, float, double, i64 } }, { { i32, float, double, i64 }, { i32, float, double, i64 } }* %E, i64 0, i32 1, i32 3 ; <i64*> [#uses=0]
  20. ret void
  21. }
  22. define i32 @test3() {
  23. %X = alloca { [4 x i32] } ; <{ [4 x i32] }*> [#uses=1]
  24. %Y = getelementptr { [4 x i32] }, { [4 x i32] }* %X, i64 0, i32 0, i64 2 ; <i32*> [#uses=2]
  25. store i32 4, i32* %Y
  26. %Z = load i32, i32* %Y ; <i32> [#uses=1]
  27. ret i32 %Z
  28. }
  29. %struct.rtx_def = type { [2 x i8], i32, [1 x %union.rtunion_def] }
  30. %union.rtunion_def = type { i32 }
  31. define void @test4() {
  32. entry:
  33. %c_addr.i = alloca i8 ; <i8*> [#uses=1]
  34. switch i32 0, label %return [
  35. i32 36, label %label.7
  36. i32 34, label %label.7
  37. i32 41, label %label.5
  38. ]
  39. label.5: ; preds = %entry
  40. ret void
  41. label.7: ; preds = %entry, %entry
  42. br i1 false, label %then.4, label %switchexit.0
  43. then.4: ; preds = %label.7
  44. %tmp.0.i = bitcast i8* %c_addr.i to i32* ; <i32*> [#uses=1]
  45. store i32 44, i32* %tmp.0.i
  46. ret void
  47. switchexit.0: ; preds = %label.7
  48. ret void
  49. return: ; preds = %entry
  50. ret void
  51. }
  52. define void @test5() {
  53. entry:
  54. %source_ptr = alloca i8*, align 4 ; <i8**> [#uses=2]
  55. br i1 false, label %bb1357, label %cond_next583
  56. cond_next583: ; preds = %entry
  57. ret void
  58. bb1357: ; preds = %entry
  59. br i1 false, label %bb1365, label %bb27055
  60. bb1365: ; preds = %bb1357
  61. switch i32 0, label %cond_next10377 [
  62. i32 0, label %bb4679
  63. i32 1, label %bb4679
  64. i32 2, label %bb4679
  65. i32 3, label %bb4679
  66. i32 4, label %bb5115
  67. i32 5, label %bb6651
  68. i32 6, label %bb7147
  69. i32 7, label %bb8683
  70. i32 8, label %bb9131
  71. i32 9, label %bb9875
  72. i32 10, label %bb4679
  73. i32 11, label %bb4859
  74. i32 12, label %bb4679
  75. i32 16, label %bb10249
  76. ]
  77. bb4679: ; preds = %bb1365, %bb1365, %bb1365, %bb1365, %bb1365, %bb1365
  78. ret void
  79. bb4859: ; preds = %bb1365
  80. ret void
  81. bb5115: ; preds = %bb1365
  82. ret void
  83. bb6651: ; preds = %bb1365
  84. ret void
  85. bb7147: ; preds = %bb1365
  86. ret void
  87. bb8683: ; preds = %bb1365
  88. ret void
  89. bb9131: ; preds = %bb1365
  90. ret void
  91. bb9875: ; preds = %bb1365
  92. %source_ptr9884 = bitcast i8** %source_ptr to i8** ; <i8**> [#uses=1]
  93. %tmp9885 = load i8*, i8** %source_ptr9884 ; <i8*> [#uses=0]
  94. ret void
  95. bb10249: ; preds = %bb1365
  96. %source_ptr10257 = bitcast i8** %source_ptr to i16** ; <i16**> [#uses=1]
  97. %tmp10258 = load i16*, i16** %source_ptr10257 ; <i16*> [#uses=0]
  98. ret void
  99. cond_next10377: ; preds = %bb1365
  100. ret void
  101. bb27055: ; preds = %bb1357
  102. ret void
  103. }
  104. %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>" = type { %"struct.__gnu_cxx::bitmap_allocator<char>::_Alloc_block"* }
  105. %"struct.__gnu_cxx::bitmap_allocator<char>" = type { i8 }
  106. %"struct.__gnu_cxx::bitmap_allocator<char>::_Alloc_block" = type { [8 x i8] }
  107. ; PR1045
  108. define void @test6() {
  109. entry:
  110. %this_addr.i = alloca %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"* ; <%"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"**> [#uses=3]
  111. %tmp = alloca %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>", align 4 ; <%"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"*> [#uses=1]
  112. store %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"* %tmp, %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"** %this_addr.i
  113. %tmp.i = load %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"*, %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"** %this_addr.i ; <%"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"*> [#uses=1]
  114. %tmp.i.upgrd.1 = bitcast %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"* %tmp.i to %"struct.__gnu_cxx::bitmap_allocator<char>"* ; <%"struct.__gnu_cxx::bitmap_allocator<char>"*> [#uses=0]
  115. %tmp1.i = load %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"*, %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"** %this_addr.i ; <%"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"*> [#uses=1]
  116. %tmp.i.upgrd.2 = getelementptr %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>", %"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator<char>::_Alloc_block*>"* %tmp1.i, i32 0, i32 0 ; <%"struct.__gnu_cxx::bitmap_allocator<char>::_Alloc_block"**> [#uses=0]
  117. unreachable
  118. }
  119. %struct.CGPoint = type { float, float }
  120. %struct.aal_big_range_t = type { i32, i32 } %struct.aal_callback_t = type { i8* (i8*, i32)*, void (i8*, i8*)* } %struct.aal_edge_pool_t = type { %struct.aal_edge_pool_t*, i32, i32, [0 x %struct.aal_edge_t] } %struct.aal_edge_t = type { %struct.CGPoint, %struct.CGPoint, i32 }
  121. %struct.aal_range_t = type { i16, i16 }
  122. %struct.aal_span_pool_t = type { %struct.aal_span_pool_t*, [341 x %struct.aal_span_t] }
  123. %struct.aal_span_t = type { %struct.aal_span_t*, %struct.aal_big_range_t }
  124. %struct.aal_spanarray_t = type { [2 x %struct.aal_range_t] }
  125. %struct.aal_spanbucket_t = type { i16, [2 x i8], %struct.anon }
  126. %struct.aal_state_t = type { %struct.CGPoint, %struct.CGPoint, %struct.CGPoint, i32, float, float, float, float, %struct.CGPoint, %struct.CGPoint, float, float, float, float, i32, i32, i32, i32, float, float, i8*, i32, i32, %struct.aal_edge_pool_t*, %struct.aal_edge_pool_t*, i8*, %struct.aal_callback_t*, i32, %struct.aal_span_t*, %struct.aal_span_t*, %struct.aal_span_t*, %struct.aal_span_pool_t*, i8, float, i8, i32 }
  127. %struct.anon = type { %struct.aal_spanarray_t }
  128. define fastcc void @test7() {
  129. entry:
  130. %SB = alloca %struct.aal_spanbucket_t, align 4 ; <%struct.aal_spanbucket_t*> [#uses=2]
  131. br i1 false, label %cond_true, label %cond_next79
  132. cond_true: ; preds = %entry
  133. br i1 false, label %cond_next, label %cond_next114.i
  134. cond_next114.i: ; preds = %cond_true
  135. ret void
  136. cond_next: ; preds = %cond_true
  137. %SB19 = bitcast %struct.aal_spanbucket_t* %SB to i8* ; <i8*> [#uses=1]
  138. call void @llvm.memcpy.p0i8.p0i8.i32(i8* %SB19, i8* null, i32 12, i32 0, i1 false)
  139. br i1 false, label %cond_next34, label %cond_next79
  140. cond_next34: ; preds = %cond_next
  141. %i.2.reload22 = load i32, i32* null ; <i32> [#uses=1]
  142. %tmp51 = getelementptr %struct.aal_spanbucket_t, %struct.aal_spanbucket_t* %SB, i32 0, i32 2, i32 0, i32 0, i32 %i.2.reload22, i32 1
  143. ; <i16*> [#uses=0]
  144. ret void
  145. cond_next79: ; preds = %cond_next, %entry
  146. ret void
  147. }
  148. %struct.c37304a__vrec = type { i8, %struct.c37304a__vrec___disc___XVN }
  149. %struct.c37304a__vrec___disc___XVN = type {
  150. %struct.c37304a__vrec___disc___XVN___O }
  151. %struct.c37304a__vrec___disc___XVN___O = type { }
  152. ; PR3304
  153. define void @test8() {
  154. entry:
  155. %v = alloca %struct.c37304a__vrec
  156. %0 = getelementptr %struct.c37304a__vrec, %struct.c37304a__vrec* %v, i32 0, i32 0
  157. store i8 8, i8* %0, align 1
  158. unreachable
  159. }
  160. ; rdar://6808691 - ZeroLengthMemSet
  161. %0 = type <{ i32, i16, i8, i8, i64, i64, i16, [0 x i16] }>
  162. define i32 @test9() {
  163. entry:
  164. %.compoundliteral = alloca %0
  165. %tmp228 = getelementptr %0, %0* %.compoundliteral, i32 0, i32 7
  166. %tmp229 = bitcast [0 x i16]* %tmp228 to i8*
  167. call void @llvm.memset.p0i8.i64(i8* %tmp229, i8 0, i64 0, i32 2, i1 false)
  168. unreachable
  169. }
  170. declare void @llvm.memset.i64(i8* nocapture, i8, i64, i32) nounwind
  171. ; PR4146 - i1 handling
  172. %wrapper = type { i1 }
  173. define void @test10() {
  174. entry:
  175. %w = alloca %wrapper, align 8 ; <%wrapper*> [#uses=1]
  176. %0 = getelementptr %wrapper, %wrapper* %w, i64 0, i32 0 ; <i1*>
  177. store i1 true, i1* %0
  178. ret void
  179. }
  180. %struct.singlebool = type <{ i8 }>
  181. ; PR4286
  182. define zeroext i8 @test11() nounwind {
  183. entry:
  184. %a = alloca %struct.singlebool, align 1 ; <%struct.singlebool*> [#uses=2]
  185. %storetmp.i = bitcast %struct.singlebool* %a to i1* ; <i1*> [#uses=1]
  186. store i1 true, i1* %storetmp.i
  187. %tmp = getelementptr %struct.singlebool, %struct.singlebool* %a, i64 0, i32 0 ; <i8*> [#uses=1]
  188. %tmp1 = load i8, i8* %tmp ; <i8> [#uses=1]
  189. ret i8 %tmp1
  190. }
  191. %struct.Item = type { [4 x i16], %struct.rule* }
  192. %struct.rule = type { [4 x i16], i32, i32, i32, %struct.nonterminal*, %struct.pattern*, i8 }
  193. %struct.nonterminal = type { i8*, i32, i32, i32, %struct.plankMap*, %struct.rule* }
  194. %struct.plankMap = type { %struct.list*, i32, %struct.stateMap* }
  195. %struct.list = type { i8*, %struct.list* }
  196. %struct.stateMap = type { i8*, %struct.plank*, i32, i16* }
  197. %struct.plank = type { i8*, %struct.list*, i32 }
  198. %struct.pattern = type { %struct.nonterminal*, %struct.operator*, [2 x %struct.nonterminal*] }
  199. %struct.operator = type { i8*, i8, i32, i32, i32, i32, %struct.table* }
  200. %struct.table = type { %struct.operator*, %struct.list*, i16*, [2 x %struct.dimension*], %struct.item_set** }
  201. %struct.dimension = type { i16*, %struct.Index_Map, %struct.mapping*, i32, %struct.plankMap* }
  202. %struct.Index_Map = type { i32, %struct.item_set** }
  203. %struct.item_set = type { i32, i32, %struct.operator*, [2 x %struct.item_set*], %struct.item_set*, i16*, %struct.Item*, %struct.Item* }
  204. %struct.mapping = type { %struct.list**, i32, i32, i32, %struct.item_set** }
  205. ; VLAs.
  206. define void @test12() {
  207. bb4.i:
  208. %malloccall = tail call i8* @malloc(i32 0)
  209. %0 = bitcast i8* %malloccall to [0 x %struct.Item]*
  210. %.sub.i.c.i = getelementptr [0 x %struct.Item], [0 x %struct.Item]* %0, i32 0, i32 0 ; <%struct.Item*> [#uses=0]
  211. unreachable
  212. }
  213. declare noalias i8* @malloc(i32)
  214. ; PR8680
  215. define void @test13() nounwind {
  216. entry:
  217. %memtmp = alloca i32, align 4
  218. %0 = bitcast i32* %memtmp to void ()*
  219. call void %0() nounwind
  220. ret void
  221. }
  222. ; rdar://11861001 - The dynamic GEP here was incorrectly making all accesses
  223. ; to the alloca think they were also dynamic. Inserts and extracts created to
  224. ; access the vector were all being based from the dynamic access, even in BBs
  225. ; not dominated by the GEP.
  226. define fastcc void @test() optsize inlinehint ssp align 2 {
  227. entry:
  228. %alloc.0.0 = alloca <4 x float>, align 16
  229. %bitcast = bitcast <4 x float>* %alloc.0.0 to [4 x float]*
  230. %idx3 = getelementptr inbounds [4 x float], [4 x float]* %bitcast, i32 0, i32 3
  231. store float 0.000000e+00, float* %idx3, align 4
  232. br label %for.body10
  233. for.body10: ; preds = %for.body10, %entry
  234. %loopidx = phi i32 [ 0, %entry ], [ undef, %for.body10 ]
  235. %unusedidx = getelementptr inbounds <4 x float>, <4 x float>* %alloc.0.0, i32 0, i32 %loopidx
  236. br i1 undef, label %for.end, label %for.body10
  237. for.end: ; preds = %for.body10
  238. store <4 x float> <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00>, <4 x float>* %alloc.0.0, align 16
  239. ret void
  240. }
  241. declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
  242. declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind