1 ; RUN: opt < %s -passes=jump-threading -S | FileCheck %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"
4 target triple = "x86_64-unknown-linux-gnu"
5 %struct.system__secondary_stack__mark_id = type { i64, i64 }
7 define void @_ada_c35507b() {
11 bb: ; preds = %bb13, %entry
12 %ch.0 = phi i8 [ 0, %entry ], [ 0, %bb13 ] ; <i8> [#uses=1]
13 %tmp11 = icmp ugt i8 %ch.0, 31 ; <i1> [#uses=1]
14 %tmp120 = call %struct.system__secondary_stack__mark_id @system__secondary_stack__ss_mark( ) ; <%struct.system__secondary_stack__mark_id> [#uses=1]
15 br i1 %tmp11, label %bb110, label %bb13
21 %mrv_gr124 = extractvalue %struct.system__secondary_stack__mark_id %tmp120, 1 ; <i64> [#uses=0]
25 declare %struct.system__secondary_stack__mark_id @system__secondary_stack__ss_mark()
29 define fastcc void @findratio(ptr nocapture %res1, ptr nocapture %res2) nounwind ssp {
34 %tmp = icmp eq i32 undef, undef
35 %tmp1 = fsub double undef, undef
36 %tmp2 = fcmp ult double %tmp1, 0.000000e+00
37 br i1 %tmp, label %bb6.us, label %bb13
41 %tmp3 = fcmp ult double undef, 0.000000e+00
45 %.lcssa31 = phi double [ undef, %bb12 ], [ %tmp1, %bb6.us ]
46 %.lcssa30 = phi i1 [ %tmp3, %bb12 ], [ %tmp2, %bb6.us ]
47 br i1 %.lcssa30, label %bb15, label %bb61
50 %tmp4 = fsub double -0.000000e+00, %.lcssa31
60 define i32 @test(i1 %cond, i1 %cond2, i32 %a) {
62 br i1 %cond, label %F, label %A1
67 %d = phi i1 [false, %A], [true, %F]
69 br i1 %d, label %B, label %G
72 br i1 %cond2, label %B, label %D
75 %f = phi i32 [%e, %G], [%e, %A1]
77 switch i32 %a, label %C [
87 %c = phi i32 [%e, %B], [%e, %B], [%e, %B], [%f, %C], [%e, %G]
94 define i32 @test2() nounwind {
96 br i1 true, label %decDivideOp.exit, label %bb7.i
98 bb7.i: ; preds = %bb7.i, %entry
101 decDivideOp.exit: ; preds = %entry
108 define i32 @test3(i32 %p_79, i32 %p_80) nounwind {
115 bb2: ; preds = %bb7, %bb1
116 %l_82.0 = phi i8 [ 0, %bb1 ], [ %l_82.1, %bb7 ] ; <i8> [#uses=3]
117 br i1 true, label %bb3, label %bb1
120 %0 = icmp eq i32 %p_80_addr.1, 0 ; <i1> [#uses=1]
121 br i1 %0, label %bb7, label %bb6
124 %1 = icmp eq i8 %l_82.0, 0 ; <i1> [#uses=1]
125 br i1 %1, label %bb1.i, label %bb.i
128 br label %safe_div_func_char_s_s.exit
130 bb1.i: ; preds = %bb5
131 br label %safe_div_func_char_s_s.exit
133 safe_div_func_char_s_s.exit: ; preds = %bb1.i, %bb.i
136 bb6: ; preds = %safe_div_func_char_s_s.exit, %bb3
137 %p_80_addr.0 = phi i32 [ %p_80_addr.1, %bb3 ], [ 1, %safe_div_func_char_s_s.exit ] ; <i32> [#uses=2]
138 %2 = icmp eq i32 %p_80_addr.0, 0 ; <i1> [#uses=1]
139 br i1 %2, label %bb7, label %bb5
141 bb7: ; preds = %bb6, %bb3, %entry
142 %l_82.1 = phi i8 [ 1, %entry ], [ %l_82.0, %bb3 ], [ %l_82.0, %bb6 ] ; <i8> [#uses=2]
143 %p_80_addr.1 = phi i32 [ 0, %entry ], [ %p_80_addr.1, %bb3 ], [ %p_80_addr.0, %bb6 ] ; <i32> [#uses=4]
144 %3 = icmp eq i32 %p_80_addr.1, 0 ; <i1> [#uses=1]
145 br i1 %3, label %bb8, label %bb2
148 %4 = sext i8 %l_82.1 to i32 ; <i32> [#uses=0]
155 define i32 @test4(i8 %X) {
161 bb33.i: ; preds = %bb33.i, %bb32.i
162 switch i8 %Y, label %bb32.i [
163 i8 39, label %bb35.split.i
174 define fastcc void @test5(i1 %tmp, i32 %tmp1) nounwind ssp {
176 br i1 %tmp, label %bb12, label %bb13
183 %.lcssa31 = phi i32 [ undef, %bb12 ], [ %tmp1, %entry ]
184 %A = and i1 undef, undef
185 br i1 %A, label %bb15, label %bb61
197 define fastcc void @test6(i1 %tmp, i1 %tmp1) nounwind ssp {
199 br i1 %tmp, label %bb12, label %bb14
205 %A = phi i1 [ %A, %bb13 ], [ true, %bb12 ], [%tmp1, %entry]
209 br i1 %A, label %bb14, label %bb61
218 define void @test7(i32 %x) {
220 br label %tailrecurse
223 switch i32 %x, label %return [
229 switch i32 %x, label %return [
231 i32 3, label %tailrecurse
242 define i32 @test8(i32 %action) nounwind {
244 switch i32 %action, label %lor.rhs [
245 i32 1, label %if.then
246 i32 0, label %lor.end
249 if.then: ; preds = %for.cond, %lor.end, %entry
252 lor.rhs: ; preds = %entry
255 lor.end: ; preds = %lor.rhs, %entry
256 %cmp103 = xor i1 undef, undef ; <i1> [#uses=1]
257 br i1 %cmp103, label %for.cond, label %if.then
259 for.cond: ; preds = %for.body, %lor.end
260 br i1 undef, label %if.then, label %for.body
262 for.body: ; preds = %for.cond
267 define i32 @test9(i32 %action) nounwind {
269 switch i32 %action, label %lor.rhs [
270 i32 1, label %if.then
271 i32 0, label %lor.end
274 if.then: ; preds = %for.cond, %lor.end, %entry
277 lor.rhs: ; preds = %entry
280 lor.end: ; preds = %lor.rhs, %entry
281 %0 = phi i1 [ undef, %lor.rhs ], [ true, %entry ] ; <i1> [#uses=1]
282 %cmp103 = xor i1 undef, %0 ; <i1> [#uses=1]
283 br i1 %cmp103, label %for.cond, label %if.then
285 for.cond: ; preds = %for.body, %lor.end
286 br i1 undef, label %if.then, label %for.body
288 for.body: ; preds = %for.cond
293 define i32 @test10(i32 %action, i32 %type) nounwind {
295 %cmp2 = icmp eq i32 %type, 0 ; <i1> [#uses=1]
296 switch i32 %action, label %lor.rhs [
297 i32 1, label %if.then
298 i32 0, label %lor.end
301 if.then: ; preds = %for.cond, %lor.end, %entry
304 lor.rhs: ; preds = %entry
305 %cmp101 = icmp eq i32 %action, 2 ; <i1> [#uses=1]
308 lor.end: ; preds = %lor.rhs, %entry
309 %0 = phi i1 [ %cmp101, %lor.rhs ], [ true, %entry ] ; <i1> [#uses=1]
310 %cmp103 = xor i1 %cmp2, %0 ; <i1> [#uses=1]
311 br i1 %cmp103, label %for.cond, label %if.then
313 for.cond: ; preds = %for.body, %lor.end
314 br i1 undef, label %if.then, label %for.body
316 for.body: ; preds = %for.cond
322 define void @test11() nounwind {
327 call void undef(i64 ptrtoint (ptr blockaddress(@test11, %A) to i64)) nounwind
332 define void @test12() nounwind ssp {
336 lbl_51: ; preds = %if.then, %entry
337 %tmp3 = phi i1 [ false, %if.then ], [ undef, %entry ] ; <i1> [#uses=2]
338 br i1 %tmp3, label %if.end12, label %if.then
340 if.then: ; preds = %lbl_51
341 br i1 %tmp3, label %lbl_51, label %if.end12
343 if.end12: ; preds = %if.then, %lbl_51
350 define i32 @test13(ptr %P, ptr %Ptr) {
352 indirectbr ptr %Ptr, [label %BrBlock, label %B2]
359 %L = load i32, ptr %P
360 %C = icmp eq i32 %L, 42
361 br i1 %C, label %T, label %F
371 define void @test14() nounwind {
373 %cmp33 = icmp slt i8 undef, 0 ; <i1> [#uses=1]
374 %tobool = icmp eq i8 undef, 0 ; <i1> [#uses=1]
375 br i1 %tobool, label %land.end69, label %land.rhs
377 land.rhs: ; preds = %entry
380 land.end69: ; preds = %land.rhs, %entry
381 %0 = phi i1 [ undef, %land.rhs ], [ true, %entry ] ; <i1> [#uses=1]
382 %cmp71 = or i1 true, %0 ; <i1> [#uses=1]
383 %cmp73 = xor i1 %cmp33, %cmp71 ; <i1> [#uses=1]
384 br i1 %cmp73, label %if.then, label %if.end
386 if.then: ; preds = %land.end69
389 if.end: ; preds = %land.end69
394 define void @test15() nounwind {
401 lbl_596: ; preds = %lbl_664, %for.end37
402 store volatile i64 undef, ptr undef, align 4
403 br label %for.cond111
405 for.cond111: ; preds = %safe_sub_func_int64_t_s_s.exit, %lbl_596
406 %storemerge = phi i8 [ undef, %cond.true.i100 ], [ 22, %lbl_596 ] ; <i8> [#uses=1]
407 %l_678.5 = phi i64 [ %l_678.3, %cond.true.i100 ], [ undef, %lbl_596 ] ; <i64> [#uses=2]
408 %cmp114 = icmp slt i8 %storemerge, -2 ; <i1> [#uses=1]
409 br i1 %cmp114, label %lbl_664, label %if.end949
411 lbl_664: ; preds = %for.end1058, %if.then237, %for.cond111
412 %l_678.3 = phi i64 [ %l_678.5, %for.cond111 ], [ %l_678.2, %for.cond1035 ], [ 5, %if.then237 ] ; <i64> [#uses=1]
413 %tobool118 = icmp eq i32 undef, 0 ; <i1> [#uses=1]
414 br i1 %tobool118, label %cond.true.i100, label %lbl_596
416 cond.true.i100: ; preds = %for.inc120
417 br label %for.cond111
422 for.cond603: ; preds = %for.body607, %if.end336
423 br i1 undef, label %for.cond603, label %if.end949
425 if.end949: ; preds = %for.cond603, %lbl_709, %for.cond111
426 %l_678.2 = phi i64 [ %l_678.5, %for.cond111 ], [ undef, %lbl_709 ], [ 5, %for.cond603 ] ; <i64> [#uses=1]
427 br label %for.body1016
429 for.body1016: ; preds = %for.cond1012
430 br label %for.body1016
432 for.cond1035: ; preds = %for.inc1055, %if.then1026
433 br i1 undef, label %for.cond1040, label %lbl_664
435 for.cond1040: ; preds = %for.body1044, %for.cond1035
440 define void @test16(i1 %c, i1 %c2, i1 %c3, i1 %c4) nounwind ssp {
442 %cmp = icmp sgt i32 undef, 1 ; <i1> [#uses=1]
443 br i1 %c, label %land.end, label %land.rhs
445 land.rhs: ; preds = %entry
446 br i1 %c2, label %lor.lhs.false.i, label %land.end
448 lor.lhs.false.i: ; preds = %land.rhs
449 br i1 %c3, label %land.end, label %land.end
452 %0 = phi i1 [ true, %entry ], [ false, %land.rhs ], [false, %lor.lhs.false.i], [false, %lor.lhs.false.i] ; <i1> [#uses=1]
453 %cmp12 = and i1 %cmp, %0
454 %xor1 = xor i1 %cmp12, %c4
455 br i1 %xor1, label %if.then, label %if.end
464 define void @test17() {
466 br i1 undef, label %bb269.us.us, label %bb269.us.us.us
469 %indvar = phi i64 [ %indvar.next, %bb287.us.us.us ], [ 0, %entry ]
470 %0 = icmp eq i16 undef, 0
471 br i1 %0, label %bb287.us.us.us, label %bb286.us.us.us
474 %indvar.next = add i64 %indvar, 1
475 %exitcond = icmp eq i64 %indvar.next, 4
476 br i1 %exitcond, label %bb288.bb289.loopexit_crit_edge, label %bb269.us.us.us
484 bb288.bb289.loopexit_crit_edge:
489 %struct.S1 = type { i8, i8 }
490 @func_89.l_245 = internal constant %struct.S1 { i8 33, i8 6 }, align 1
491 define void @func_89(i16 zeroext %p_90, ptr nocapture %p_91, ptr nocapture %p_92) nounwind ssp {
493 store i32 0, ptr %p_92, align 4
494 br i1 false, label %lbl_260, label %if.else
496 if.else: ; preds = %entry
499 for.cond: ; preds = %lbl_260, %if.else
500 %l_245.0 = phi i16 [ %l_245.1, %lbl_260 ], [ 33, %if.else ]
501 %l_261.0 = phi i32 [ %and, %lbl_260 ], [ 255, %if.else ]
502 %tobool21 = icmp ult i16 %l_245.0, 256
503 br i1 %tobool21, label %if.end, label %lbl_260
505 lbl_260: ; preds = %for.cond, %entry
506 %l_245.1 = phi i16 [ 1569, %entry ], [ %l_245.0, %for.cond ]
507 %l_261.1 = phi i32 [ 255, %entry ], [ %l_261.0, %for.cond ]
508 %and = and i32 %l_261.1, 1
511 if.end: ; preds = %for.cond
515 define void @PR14233(i1 %cmp, i1 %cmp2, i1 %cmp3, i1 %cmp4) {
517 br i1 %cmp, label %cond.true, label %cond.false
526 %A = phi i64 [ 0, %cond.true ], [ 1, %cond.false ]
527 br i1 %cmp2, label %bb, label %if.end2
533 %B = phi i64 [ ptrtoint (ptr @PR14233.f1 to i64), %bb ], [ %A, %if.end ]
534 %cmp.ptr = icmp eq i64 %B, ptrtoint (ptr @PR14233.f2 to i64)
535 br i1 %cmp.ptr, label %cond.true2, label %if.end3
538 br i1 %cmp3, label %bb2, label %ur
541 br i1 %cmp4, label %if.end4, label %if.end3
547 %cmp.ptr2 = icmp eq i64 %B, ptrtoint (ptr @PR14233.f2 to i64)
548 br i1 %cmp.ptr2, label %ur, label %if.then601
551 %C = icmp eq i64 %B, 0
552 br i1 %C, label %bb3, label %bb4
564 declare ptr @PR14233.f1()
566 declare ptr @PR14233.f2()
568 ; Make sure the following compiles in a sane amount of time, as opposed
569 ; to taking exponential time.
570 ; (CHECK to make sure the condition doesn't get simplified somehow;
571 ; if it does, the testcase will need to be revised.)
572 ; CHECK-LABEL: define void @almost_infinite_loop
573 ; CHECK: %x39 = or i1 %x38, %x38
574 ; CHECK: br i1 %x39, label %dest1, label %dest2
575 define void @almost_infinite_loop(i1 %x0) {
577 br label %if.then57.i
589 %x10 = or i1 %x9, %x9
590 %x11 = or i1 %x10, %x10
591 %x12 = or i1 %x11, %x11
592 %x13 = or i1 %x12, %x12
593 %x14 = or i1 %x13, %x13
594 %x15 = or i1 %x14, %x14
595 %x16 = or i1 %x15, %x15
596 %x17 = or i1 %x16, %x16
597 %x18 = or i1 %x17, %x17
598 %x19 = or i1 %x18, %x18
599 %x20 = or i1 %x19, %x19
600 %x21 = or i1 %x20, %x20
601 %x22 = or i1 %x21, %x21
602 %x23 = or i1 %x22, %x22
603 %x24 = or i1 %x23, %x23
604 %x25 = or i1 %x24, %x24
605 %x26 = or i1 %x25, %x25
606 %x27 = or i1 %x26, %x26
607 %x28 = or i1 %x27, %x27
608 %x29 = or i1 %x28, %x28
609 %x30 = or i1 %x29, %x29
610 %x31 = or i1 %x30, %x30
611 %x32 = or i1 %x31, %x31
612 %x33 = or i1 %x32, %x32
613 %x34 = or i1 %x33, %x33
614 %x35 = or i1 %x34, %x34
615 %x36 = or i1 %x35, %x35
616 %x37 = or i1 %x36, %x36
617 %x38 = or i1 %x37, %x37
618 %x39 = or i1 %x38, %x38
619 br i1 %x39, label %dest1, label %dest2