crash.ll 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. ; RUN: opt < %s -jump-threading -disable-output
  2. ; PR2285
  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"
  4. target triple = "x86_64-unknown-linux-gnu"
  5. %struct.system__secondary_stack__mark_id = type { i64, i64 }
  6. define void @_ada_c35507b() {
  7. entry:
  8. br label %bb
  9. bb: ; preds = %bb13, %entry
  10. %ch.0 = phi i8 [ 0, %entry ], [ 0, %bb13 ] ; <i8> [#uses=1]
  11. %tmp11 = icmp ugt i8 %ch.0, 31 ; <i1> [#uses=1]
  12. %tmp120 = call %struct.system__secondary_stack__mark_id @system__secondary_stack__ss_mark( ) ; <%struct.system__secondary_stack__mark_id> [#uses=1]
  13. br i1 %tmp11, label %bb110, label %bb13
  14. bb13: ; preds = %bb
  15. br label %bb
  16. bb110: ; preds = %bb
  17. %mrv_gr124 = extractvalue %struct.system__secondary_stack__mark_id %tmp120, 1 ; <i64> [#uses=0]
  18. unreachable
  19. }
  20. declare %struct.system__secondary_stack__mark_id @system__secondary_stack__ss_mark()
  21. define fastcc void @findratio(double* nocapture %res1, double* nocapture %res2) nounwind ssp {
  22. entry:
  23. br label %bb12
  24. bb6.us:
  25. %tmp = icmp eq i32 undef, undef
  26. %tmp1 = fsub double undef, undef
  27. %tmp2 = fcmp ult double %tmp1, 0.000000e+00
  28. br i1 %tmp, label %bb6.us, label %bb13
  29. bb12:
  30. %tmp3 = fcmp ult double undef, 0.000000e+00
  31. br label %bb13
  32. bb13:
  33. %.lcssa31 = phi double [ undef, %bb12 ], [ %tmp1, %bb6.us ]
  34. %.lcssa30 = phi i1 [ %tmp3, %bb12 ], [ %tmp2, %bb6.us ]
  35. br i1 %.lcssa30, label %bb15, label %bb61
  36. bb15:
  37. %tmp4 = fsub double -0.000000e+00, %.lcssa31
  38. ret void
  39. bb61:
  40. ret void
  41. }
  42. ; PR5258
  43. define i32 @test(i1 %cond, i1 %cond2, i32 %a) {
  44. A:
  45. br i1 %cond, label %F, label %A1
  46. F:
  47. br label %A1
  48. A1:
  49. %d = phi i1 [false, %A], [true, %F]
  50. %e = add i32 %a, %a
  51. br i1 %d, label %B, label %G
  52. G:
  53. br i1 %cond2, label %B, label %D
  54. B:
  55. %f = phi i32 [%e, %G], [%e, %A1]
  56. %b = add i32 0, 0
  57. switch i32 %a, label %C [
  58. i32 7, label %D
  59. i32 8, label %D
  60. i32 9, label %D
  61. ]
  62. C:
  63. br label %D
  64. D:
  65. %c = phi i32 [%e, %B], [%e, %B], [%e, %B], [%f, %C], [%e, %G]
  66. ret i32 %c
  67. E:
  68. ret i32 412
  69. }
  70. define i32 @test2() nounwind {
  71. entry:
  72. br i1 true, label %decDivideOp.exit, label %bb7.i
  73. bb7.i: ; preds = %bb7.i, %entry
  74. br label %bb7.i
  75. decDivideOp.exit: ; preds = %entry
  76. ret i32 undef
  77. }
  78. ; PR3298
  79. define i32 @test3(i32 %p_79, i32 %p_80) nounwind {
  80. entry:
  81. br label %bb7
  82. bb1: ; preds = %bb2
  83. br label %bb2
  84. bb2: ; preds = %bb7, %bb1
  85. %l_82.0 = phi i8 [ 0, %bb1 ], [ %l_82.1, %bb7 ] ; <i8> [#uses=3]
  86. br i1 true, label %bb3, label %bb1
  87. bb3: ; preds = %bb2
  88. %0 = icmp eq i32 %p_80_addr.1, 0 ; <i1> [#uses=1]
  89. br i1 %0, label %bb7, label %bb6
  90. bb5: ; preds = %bb6
  91. %1 = icmp eq i8 %l_82.0, 0 ; <i1> [#uses=1]
  92. br i1 %1, label %bb1.i, label %bb.i
  93. bb.i: ; preds = %bb5
  94. br label %safe_div_func_char_s_s.exit
  95. bb1.i: ; preds = %bb5
  96. br label %safe_div_func_char_s_s.exit
  97. safe_div_func_char_s_s.exit: ; preds = %bb1.i, %bb.i
  98. br label %bb6
  99. bb6: ; preds = %safe_div_func_char_s_s.exit, %bb3
  100. %p_80_addr.0 = phi i32 [ %p_80_addr.1, %bb3 ], [ 1, %safe_div_func_char_s_s.exit ] ; <i32> [#uses=2]
  101. %2 = icmp eq i32 %p_80_addr.0, 0 ; <i1> [#uses=1]
  102. br i1 %2, label %bb7, label %bb5
  103. bb7: ; preds = %bb6, %bb3, %entry
  104. %l_82.1 = phi i8 [ 1, %entry ], [ %l_82.0, %bb3 ], [ %l_82.0, %bb6 ] ; <i8> [#uses=2]
  105. %p_80_addr.1 = phi i32 [ 0, %entry ], [ %p_80_addr.1, %bb3 ], [ %p_80_addr.0, %bb6 ] ; <i32> [#uses=4]
  106. %3 = icmp eq i32 %p_80_addr.1, 0 ; <i1> [#uses=1]
  107. br i1 %3, label %bb8, label %bb2
  108. bb8: ; preds = %bb7
  109. %4 = sext i8 %l_82.1 to i32 ; <i32> [#uses=0]
  110. ret i32 0
  111. }
  112. ; PR3353
  113. define i32 @test4(i8 %X) {
  114. entry:
  115. %Y = add i8 %X, 1
  116. %Z = add i8 %Y, 1
  117. br label %bb33.i
  118. bb33.i: ; preds = %bb33.i, %bb32.i
  119. switch i8 %Y, label %bb32.i [
  120. i8 39, label %bb35.split.i
  121. i8 13, label %bb33.i
  122. ]
  123. bb35.split.i:
  124. ret i32 5
  125. bb32.i:
  126. ret i32 1
  127. }
  128. define fastcc void @test5(i1 %tmp, i32 %tmp1) nounwind ssp {
  129. entry:
  130. br i1 %tmp, label %bb12, label %bb13
  131. bb12:
  132. br label %bb13
  133. bb13:
  134. %.lcssa31 = phi i32 [ undef, %bb12 ], [ %tmp1, %entry ]
  135. %A = and i1 undef, undef
  136. br i1 %A, label %bb15, label %bb61
  137. bb15:
  138. ret void
  139. bb61:
  140. ret void
  141. }
  142. ; PR5640
  143. define fastcc void @test6(i1 %tmp, i1 %tmp1) nounwind ssp {
  144. entry:
  145. br i1 %tmp, label %bb12, label %bb14
  146. bb12:
  147. br label %bb14
  148. bb14:
  149. %A = phi i1 [ %A, %bb13 ], [ true, %bb12 ], [%tmp1, %entry]
  150. br label %bb13
  151. bb13:
  152. br i1 %A, label %bb14, label %bb61
  153. bb61:
  154. ret void
  155. }
  156. ; PR5698
  157. define void @test7(i32 %x) {
  158. entry:
  159. br label %tailrecurse
  160. tailrecurse:
  161. switch i32 %x, label %return [
  162. i32 2, label %bb2
  163. i32 3, label %bb
  164. ]
  165. bb:
  166. switch i32 %x, label %return [
  167. i32 2, label %bb2
  168. i32 3, label %tailrecurse
  169. ]
  170. bb2:
  171. ret void
  172. return:
  173. ret void
  174. }
  175. ; PR6119
  176. define i32 @test8(i32 %action) nounwind {
  177. entry:
  178. switch i32 %action, label %lor.rhs [
  179. i32 1, label %if.then
  180. i32 0, label %lor.end
  181. ]
  182. if.then: ; preds = %for.cond, %lor.end, %entry
  183. ret i32 undef
  184. lor.rhs: ; preds = %entry
  185. br label %lor.end
  186. lor.end: ; preds = %lor.rhs, %entry
  187. %cmp103 = xor i1 undef, undef ; <i1> [#uses=1]
  188. br i1 %cmp103, label %for.cond, label %if.then
  189. for.cond: ; preds = %for.body, %lor.end
  190. br i1 undef, label %if.then, label %for.body
  191. for.body: ; preds = %for.cond
  192. br label %for.cond
  193. }
  194. ; PR6119
  195. define i32 @test9(i32 %action) nounwind {
  196. entry:
  197. switch i32 %action, label %lor.rhs [
  198. i32 1, label %if.then
  199. i32 0, label %lor.end
  200. ]
  201. if.then: ; preds = %for.cond, %lor.end, %entry
  202. ret i32 undef
  203. lor.rhs: ; preds = %entry
  204. br label %lor.end
  205. lor.end: ; preds = %lor.rhs, %entry
  206. %0 = phi i1 [ undef, %lor.rhs ], [ true, %entry ] ; <i1> [#uses=1]
  207. %cmp103 = xor i1 undef, %0 ; <i1> [#uses=1]
  208. br i1 %cmp103, label %for.cond, label %if.then
  209. for.cond: ; preds = %for.body, %lor.end
  210. br i1 undef, label %if.then, label %for.body
  211. for.body: ; preds = %for.cond
  212. br label %for.cond
  213. }
  214. ; PR6119
  215. define i32 @test10(i32 %action, i32 %type) nounwind {
  216. entry:
  217. %cmp2 = icmp eq i32 %type, 0 ; <i1> [#uses=1]
  218. switch i32 %action, label %lor.rhs [
  219. i32 1, label %if.then
  220. i32 0, label %lor.end
  221. ]
  222. if.then: ; preds = %for.cond, %lor.end, %entry
  223. ret i32 undef
  224. lor.rhs: ; preds = %entry
  225. %cmp101 = icmp eq i32 %action, 2 ; <i1> [#uses=1]
  226. br label %lor.end
  227. lor.end: ; preds = %lor.rhs, %entry
  228. %0 = phi i1 [ %cmp101, %lor.rhs ], [ true, %entry ] ; <i1> [#uses=1]
  229. %cmp103 = xor i1 %cmp2, %0 ; <i1> [#uses=1]
  230. br i1 %cmp103, label %for.cond, label %if.then
  231. for.cond: ; preds = %for.body, %lor.end
  232. br i1 undef, label %if.then, label %for.body
  233. for.body: ; preds = %for.cond
  234. br label %for.cond
  235. }
  236. ; PR6305
  237. define void @test11() nounwind {
  238. entry:
  239. br label %A
  240. A: ; preds = %entry
  241. call void undef(i64 ptrtoint (i8* blockaddress(@test11, %A) to i64)) nounwind
  242. unreachable
  243. }
  244. ; PR6743
  245. define void @test12() nounwind ssp {
  246. entry:
  247. br label %lbl_51
  248. lbl_51: ; preds = %if.then, %entry
  249. %tmp3 = phi i1 [ false, %if.then ], [ undef, %entry ] ; <i1> [#uses=2]
  250. br i1 %tmp3, label %if.end12, label %if.then
  251. if.then: ; preds = %lbl_51
  252. br i1 %tmp3, label %lbl_51, label %if.end12
  253. if.end12: ; preds = %if.then, %lbl_51
  254. ret void
  255. }
  256. ; PR7356
  257. define i32 @test13(i32* %P, i8* %Ptr) {
  258. entry:
  259. indirectbr i8* %Ptr, [label %BrBlock, label %B2]
  260. B2:
  261. store i32 4, i32 *%P
  262. br label %BrBlock
  263. BrBlock:
  264. %L = load i32, i32* %P
  265. %C = icmp eq i32 %L, 42
  266. br i1 %C, label %T, label %F
  267. T:
  268. ret i32 123
  269. F:
  270. ret i32 1422
  271. }
  272. ; PR7498
  273. define void @test14() nounwind {
  274. entry:
  275. %cmp33 = icmp slt i8 undef, 0 ; <i1> [#uses=1]
  276. %tobool = icmp eq i8 undef, 0 ; <i1> [#uses=1]
  277. br i1 %tobool, label %land.end69, label %land.rhs
  278. land.rhs: ; preds = %entry
  279. br label %land.end69
  280. land.end69: ; preds = %land.rhs, %entry
  281. %0 = phi i1 [ undef, %land.rhs ], [ true, %entry ] ; <i1> [#uses=1]
  282. %cmp71 = or i1 true, %0 ; <i1> [#uses=1]
  283. %cmp73 = xor i1 %cmp33, %cmp71 ; <i1> [#uses=1]
  284. br i1 %cmp73, label %if.then, label %if.end
  285. if.then: ; preds = %land.end69
  286. ret void
  287. if.end: ; preds = %land.end69
  288. ret void
  289. }
  290. ; PR7647
  291. define void @test15() nounwind {
  292. entry:
  293. ret void
  294. if.then237:
  295. br label %lbl_664
  296. lbl_596: ; preds = %lbl_664, %for.end37
  297. store volatile i64 undef, i64* undef, align 4
  298. br label %for.cond111
  299. for.cond111: ; preds = %safe_sub_func_int64_t_s_s.exit, %lbl_596
  300. %storemerge = phi i8 [ undef, %cond.true.i100 ], [ 22, %lbl_596 ] ; <i8> [#uses=1]
  301. %l_678.5 = phi i64 [ %l_678.3, %cond.true.i100 ], [ undef, %lbl_596 ] ; <i64> [#uses=2]
  302. %cmp114 = icmp slt i8 %storemerge, -2 ; <i1> [#uses=1]
  303. br i1 %cmp114, label %lbl_664, label %if.end949
  304. lbl_664: ; preds = %for.end1058, %if.then237, %for.cond111
  305. %l_678.3 = phi i64 [ %l_678.5, %for.cond111 ], [ %l_678.2, %for.cond1035 ], [ 5, %if.then237 ] ; <i64> [#uses=1]
  306. %tobool118 = icmp eq i32 undef, 0 ; <i1> [#uses=1]
  307. br i1 %tobool118, label %cond.true.i100, label %lbl_596
  308. cond.true.i100: ; preds = %for.inc120
  309. br label %for.cond111
  310. lbl_709:
  311. br label %if.end949
  312. for.cond603: ; preds = %for.body607, %if.end336
  313. br i1 undef, label %for.cond603, label %if.end949
  314. if.end949: ; preds = %for.cond603, %lbl_709, %for.cond111
  315. %l_678.2 = phi i64 [ %l_678.5, %for.cond111 ], [ undef, %lbl_709 ], [ 5, %for.cond603 ] ; <i64> [#uses=1]
  316. br label %for.body1016
  317. for.body1016: ; preds = %for.cond1012
  318. br label %for.body1016
  319. for.cond1035: ; preds = %for.inc1055, %if.then1026
  320. br i1 undef, label %for.cond1040, label %lbl_664
  321. for.cond1040: ; preds = %for.body1044, %for.cond1035
  322. ret void
  323. }
  324. ; PR7755
  325. define void @test16(i1 %c, i1 %c2, i1 %c3, i1 %c4) nounwind ssp {
  326. entry:
  327. %cmp = icmp sgt i32 undef, 1 ; <i1> [#uses=1]
  328. br i1 %c, label %land.end, label %land.rhs
  329. land.rhs: ; preds = %entry
  330. br i1 %c2, label %lor.lhs.false.i, label %land.end
  331. lor.lhs.false.i: ; preds = %land.rhs
  332. br i1 %c3, label %land.end, label %land.end
  333. land.end:
  334. %0 = phi i1 [ true, %entry ], [ false, %land.rhs ], [false, %lor.lhs.false.i], [false, %lor.lhs.false.i] ; <i1> [#uses=1]
  335. %cmp12 = and i1 %cmp, %0
  336. %xor1 = xor i1 %cmp12, %c4
  337. br i1 %xor1, label %if.then, label %if.end
  338. if.then:
  339. ret void
  340. if.end:
  341. ret void
  342. }
  343. define void @test17() {
  344. entry:
  345. br i1 undef, label %bb269.us.us, label %bb269.us.us.us
  346. bb269.us.us.us:
  347. %indvar = phi i64 [ %indvar.next, %bb287.us.us.us ], [ 0, %entry ]
  348. %0 = icmp eq i16 undef, 0
  349. br i1 %0, label %bb287.us.us.us, label %bb286.us.us.us
  350. bb287.us.us.us:
  351. %indvar.next = add i64 %indvar, 1
  352. %exitcond = icmp eq i64 %indvar.next, 4
  353. br i1 %exitcond, label %bb288.bb289.loopexit_crit_edge, label %bb269.us.us.us
  354. bb286.us.us.us:
  355. unreachable
  356. bb269.us.us:
  357. unreachable
  358. bb288.bb289.loopexit_crit_edge:
  359. unreachable
  360. }
  361. ; PR 8247
  362. %struct.S1 = type { i8, i8 }
  363. @func_89.l_245 = internal constant %struct.S1 { i8 33, i8 6 }, align 1
  364. define void @func_89(i16 zeroext %p_90, %struct.S1* nocapture %p_91, i32* nocapture %p_92) nounwind ssp {
  365. entry:
  366. store i32 0, i32* %p_92, align 4
  367. br i1 false, label %lbl_260, label %if.else
  368. if.else: ; preds = %entry
  369. br label %for.cond
  370. for.cond: ; preds = %lbl_260, %if.else
  371. %l_245.0 = phi i16 [ %l_245.1, %lbl_260 ], [ 33, %if.else ]
  372. %l_261.0 = phi i32 [ %and, %lbl_260 ], [ 255, %if.else ]
  373. %tobool21 = icmp ult i16 %l_245.0, 256
  374. br i1 %tobool21, label %if.end, label %lbl_260
  375. lbl_260: ; preds = %for.cond, %entry
  376. %l_245.1 = phi i16 [ 1569, %entry ], [ %l_245.0, %for.cond ]
  377. %l_261.1 = phi i32 [ 255, %entry ], [ %l_261.0, %for.cond ]
  378. %and = and i32 %l_261.1, 1
  379. br label %for.cond
  380. if.end: ; preds = %for.cond
  381. ret void
  382. }
  383. define void @PR14233(i1 %cmp, i1 %cmp2, i1 %cmp3, i1 %cmp4) {
  384. entry:
  385. br i1 %cmp, label %cond.true, label %cond.false
  386. cond.true:
  387. br label %if.end
  388. cond.false:
  389. br label %if.end
  390. if.end:
  391. %A = phi i64 [ 0, %cond.true ], [ 1, %cond.false ]
  392. br i1 %cmp2, label %bb, label %if.end2
  393. bb:
  394. br label %if.end2
  395. if.end2:
  396. %B = phi i64 [ ptrtoint (i8* ()* @PR14233.f1 to i64), %bb ], [ %A, %if.end ]
  397. %cmp.ptr = icmp eq i64 %B, ptrtoint (i8* ()* @PR14233.f2 to i64)
  398. br i1 %cmp.ptr, label %cond.true2, label %if.end3
  399. cond.true2:
  400. br i1 %cmp3, label %bb2, label %ur
  401. bb2:
  402. br i1 %cmp4, label %if.end4, label %if.end3
  403. if.end4:
  404. unreachable
  405. if.end3:
  406. %cmp.ptr2 = icmp eq i64 %B, ptrtoint (i8* ()* @PR14233.f2 to i64)
  407. br i1 %cmp.ptr2, label %ur, label %if.then601
  408. if.then601:
  409. %C = icmp eq i64 %B, 0
  410. br i1 %C, label %bb3, label %bb4
  411. bb3:
  412. unreachable
  413. bb4:
  414. unreachable
  415. ur:
  416. unreachable
  417. }
  418. declare i8* @PR14233.f1()
  419. declare i8* @PR14233.f2()