brintos

brintos / llvm-project-archived public Read only

0
0
Text · 15.5 KiB · 4fab807 Raw
627 lines · plain
1; RUN: opt < %s -passes=jump-threading -S | FileCheck %s2; PR22853target 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"4target triple = "x86_64-unknown-linux-gnu"5	%struct.system__secondary_stack__mark_id = type { i64, i64 }6 7define void @_ada_c35507b() {8entry:9	br label %bb10 11bb:		; preds = %bb13, %entry12	%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 %bb1316 17bb13:		; preds = %bb18	br label %bb19 20bb110:		; preds = %bb21	%mrv_gr124 = extractvalue %struct.system__secondary_stack__mark_id %tmp120, 1		; <i64> [#uses=0]22	unreachable23}24 25declare %struct.system__secondary_stack__mark_id @system__secondary_stack__ss_mark()26 27 28 29define fastcc void @findratio(ptr nocapture %res1, ptr nocapture %res2) nounwind ssp {30entry:31  br label %bb1232 33bb6.us:34  %tmp = icmp eq i32 undef, undef35  %tmp1 = fsub double undef, undef36  %tmp2 = fcmp ult double %tmp1, 0.000000e+0037  br i1 %tmp, label %bb6.us, label %bb1338 39 40bb12:41  %tmp3 = fcmp ult double undef, 0.000000e+0042  br label %bb1343 44bb13: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 %bb6148 49bb15:50  %tmp4 = fsub double -0.000000e+00, %.lcssa3151  ret void52 53 54bb61:55  ret void56}57 58 59; PR525860define i32 @test(i1 %cond, i1 %cond2, i32 %a) {61A:62  br i1 %cond, label %F, label %A163F:64  br label %A165 66A1:67  %d = phi i1 [false, %A], [true, %F]68  %e = add i32 %a, %a69  br i1 %d, label %B, label %G70 71G:72  br i1 %cond2, label %B, label %D73 74B:75  %f = phi i32 [%e, %G], [%e, %A1]76  %b = add i32 0, 077  switch i32 %a, label %C [78    i32 7, label %D79    i32 8, label %D80    i32 9, label %D81  ]82 83C:84  br label %D85 86D:87  %c = phi i32 [%e, %B], [%e, %B], [%e, %B], [%f, %C], [%e, %G]88  ret i32 %c89E:90  ret i32 41291}92 93 94define i32 @test2() nounwind {95entry:96        br i1 true, label %decDivideOp.exit, label %bb7.i97 98bb7.i:          ; preds = %bb7.i, %entry99        br label %bb7.i100 101decDivideOp.exit:               ; preds = %entry102        ret i32 undef103}104 105 106; PR3298107 108define i32 @test3(i32 %p_79, i32 %p_80) nounwind {109entry:110	br label %bb7111 112bb1:		; preds = %bb2113	br label %bb2114 115bb2:		; preds = %bb7, %bb1116	%l_82.0 = phi i8 [ 0, %bb1 ], [ %l_82.1, %bb7 ]		; <i8> [#uses=3]117	br i1 true, label %bb3, label %bb1118 119bb3:		; preds = %bb2120	%0 = icmp eq i32 %p_80_addr.1, 0		; <i1> [#uses=1]121	br i1 %0, label %bb7, label %bb6122 123bb5:		; preds = %bb6124	%1 = icmp eq i8 %l_82.0, 0		; <i1> [#uses=1]125	br i1 %1, label %bb1.i, label %bb.i126 127bb.i:		; preds = %bb5128	br label %safe_div_func_char_s_s.exit129 130bb1.i:		; preds = %bb5131	br label %safe_div_func_char_s_s.exit132 133safe_div_func_char_s_s.exit:		; preds = %bb1.i, %bb.i134	br label %bb6135 136bb6:		; preds = %safe_div_func_char_s_s.exit, %bb3137	%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 %bb5140 141bb7:		; preds = %bb6, %bb3, %entry142	%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 %bb2146 147bb8:		; preds = %bb7148	%4 = sext i8 %l_82.1 to i32		; <i32> [#uses=0]149	ret i32 0150}151 152 153; PR3353154 155define i32 @test4(i8 %X) {156entry:157        %Y = add i8 %X, 1158        %Z = add i8 %Y, 1159        br label %bb33.i160 161bb33.i:         ; preds = %bb33.i, %bb32.i162        switch i8 %Y, label %bb32.i [163                i8 39, label %bb35.split.i164                i8 13, label %bb33.i165        ]166 167bb35.split.i:168        ret i32 5169bb32.i:170        ret i32 1171}172 173 174define fastcc void @test5(i1 %tmp, i32 %tmp1) nounwind ssp {175entry:176  br i1 %tmp, label %bb12, label %bb13177 178 179bb12:180  br label %bb13181 182bb13:183  %.lcssa31 = phi i32 [ undef, %bb12 ], [ %tmp1, %entry ]184  %A = and i1 undef, undef185  br i1 %A, label %bb15, label %bb61186 187bb15:188  ret void189 190 191bb61:192  ret void193}194 195 196; PR5640197define fastcc void @test6(i1 %tmp, i1 %tmp1) nounwind ssp {198entry:199  br i1 %tmp, label %bb12, label %bb14200 201bb12:202  br label %bb14203 204bb14:205  %A = phi i1 [ %A, %bb13 ],  [ true, %bb12 ], [%tmp1, %entry]206  br label %bb13207 208bb13:209  br i1 %A, label %bb14, label %bb61210 211 212bb61:213  ret void214}215 216 217; PR5698218define void @test7(i32 %x) {219entry:220  br label %tailrecurse221 222tailrecurse:223  switch i32 %x, label %return [224    i32 2, label %bb2225    i32 3, label %bb226  ]227 228bb:229  switch i32 %x, label %return [230    i32 2, label %bb2231    i32 3, label %tailrecurse232  ]233 234bb2:235  ret void236 237return:238  ret void239}240 241; PR6119242define i32 @test8(i32 %action, i1 %arg) nounwind {243entry:244  switch i32 %action, label %lor.rhs [245    i32 1, label %if.then246    i32 0, label %lor.end247  ]248 249if.then:                                          ; preds = %for.cond, %lor.end, %entry250  ret i32 undef251 252lor.rhs:                                          ; preds = %entry253  br label %lor.end254 255lor.end:                                          ; preds = %lor.rhs, %entry256  %cmp103 = xor i1 undef, undef                   ; <i1> [#uses=1]257  br i1 %cmp103, label %for.cond, label %if.then258 259for.cond:                                         ; preds = %for.body, %lor.end260  br i1 %arg, label %if.then, label %for.body261 262for.body:                                         ; preds = %for.cond263  br label %for.cond264}265 266; PR6119267define i32 @test9(i32 %action, i1 %arg) nounwind {268entry:269  switch i32 %action, label %lor.rhs [270    i32 1, label %if.then271    i32 0, label %lor.end272  ]273 274if.then:                                          ; preds = %for.cond, %lor.end, %entry275  ret i32 undef276 277lor.rhs:                                          ; preds = %entry278  br label %lor.end279 280lor.end:                                          ; preds = %lor.rhs, %entry281  %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.then284 285for.cond:                                         ; preds = %for.body, %lor.end286  br i1 %arg, label %if.then, label %for.body287 288for.body:                                         ; preds = %for.cond289  br label %for.cond290}291 292; PR6119293define i32 @test10(i32 %action, i32 %type, i1 %arg) nounwind {294entry:295  %cmp2 = icmp eq i32 %type, 0                    ; <i1> [#uses=1]296  switch i32 %action, label %lor.rhs [297    i32 1, label %if.then298    i32 0, label %lor.end299  ]300 301if.then:                                          ; preds = %for.cond, %lor.end, %entry302  ret i32 undef303 304lor.rhs:                                          ; preds = %entry305  %cmp101 = icmp eq i32 %action, 2                ; <i1> [#uses=1]306  br label %lor.end307 308lor.end:                                          ; preds = %lor.rhs, %entry309  %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.then312 313for.cond:                                         ; preds = %for.body, %lor.end314  br i1 %arg, label %if.then, label %for.body315 316for.body:                                         ; preds = %for.cond317  br label %for.cond318}319 320 321; PR6305322define void @test11() nounwind {323entry:324  br label %A325 326A:                                             ; preds = %entry327  call void undef(i64 ptrtoint (ptr blockaddress(@test11, %A) to i64)) nounwind328  unreachable329}330 331; PR6743332define void @test12() nounwind ssp {333entry:334  br label %lbl_51335 336lbl_51:                                           ; preds = %if.then, %entry337  %tmp3 = phi i1 [ false, %if.then ], [ undef, %entry ] ; <i1> [#uses=2]338  br i1 %tmp3, label %if.end12, label %if.then339 340if.then:                                          ; preds = %lbl_51341  br i1 %tmp3, label %lbl_51, label %if.end12342 343if.end12:                                         ; preds = %if.then, %lbl_51344  ret void345}346 347 348 349; PR7356350define i32 @test13(ptr %P, ptr %Ptr) {351entry:352  indirectbr ptr %Ptr, [label %BrBlock, label %B2]353 354B2:355  store i32 4, ptr %P356  br label %BrBlock357 358BrBlock:359  %L = load i32, ptr %P360  %C = icmp eq i32 %L, 42361  br i1 %C, label %T, label %F362 363T:364  ret i32 123365F:366  ret i32 1422367}368 369 370; PR7498371define void @test14() nounwind {372entry: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.rhs376 377land.rhs:                                         ; preds = %entry378  br label %land.end69379 380land.end69:                                       ; preds = %land.rhs, %entry381  %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.end385 386if.then:                                          ; preds = %land.end69387  ret void388 389if.end:                                           ; preds = %land.end69390  ret void391}392 393; PR7647394define void @test15(i1 %arg) nounwind {395entry:396  ret void397 398if.then237:399  br label %lbl_664400 401lbl_596:                                          ; preds = %lbl_664, %for.end37402  store volatile i64 undef, ptr undef, align 4403  br label %for.cond111404 405for.cond111:                                      ; preds = %safe_sub_func_int64_t_s_s.exit, %lbl_596406  %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.end949410 411lbl_664:                                          ; preds = %for.end1058, %if.then237, %for.cond111412  %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_596415 416cond.true.i100:                                   ; preds = %for.inc120417  br label %for.cond111418 419lbl_709:420  br label %if.end949421 422for.cond603:                                      ; preds = %for.body607, %if.end336423  br i1 %arg, label %for.cond603, label %if.end949424 425if.end949:                                        ; preds = %for.cond603, %lbl_709, %for.cond111426  %l_678.2 = phi i64 [ %l_678.5, %for.cond111 ], [ undef, %lbl_709 ], [ 5, %for.cond603 ] ; <i64> [#uses=1]427  br label %for.body1016428 429for.body1016:                                     ; preds = %for.cond1012430  br label %for.body1016431 432for.cond1035:                                     ; preds = %for.inc1055, %if.then1026433  br i1 %arg, label %for.cond1040, label %lbl_664434 435for.cond1040:                                     ; preds = %for.body1044, %for.cond1035436  ret void437}438 439; PR7755440define void @test16(i1 %c, i1 %c2, i1 %c3, i1 %c4) nounwind ssp {441entry:442  %cmp = icmp sgt i32 undef, 1                    ; <i1> [#uses=1]443  br i1 %c, label %land.end, label %land.rhs444 445land.rhs:                                         ; preds = %entry446  br i1 %c2, label %lor.lhs.false.i, label %land.end447 448lor.lhs.false.i:                                  ; preds = %land.rhs449  br i1 %c3, label %land.end, label %land.end450 451land.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, %0454  %xor1 = xor i1 %cmp12, %c4455  br i1 %xor1, label %if.then, label %if.end456 457if.then:458  ret void459 460if.end:461  ret void462}463 464define void @test17(i1 %arg) {465entry:466  br i1 %arg, label %bb269.us.us, label %bb269.us.us.us467 468bb269.us.us.us:469  %indvar = phi i64 [ %indvar.next, %bb287.us.us.us ], [ 0, %entry ]470  %0 = icmp eq i16 undef, 0471  br i1 %0, label %bb287.us.us.us, label %bb286.us.us.us472 473bb287.us.us.us:474  %indvar.next = add i64 %indvar, 1475  %exitcond = icmp eq i64 %indvar.next, 4476  br i1 %exitcond, label %bb288.bb289.loopexit_crit_edge, label %bb269.us.us.us477 478bb286.us.us.us:479  unreachable480 481bb269.us.us:482	unreachable483 484bb288.bb289.loopexit_crit_edge:485  unreachable486}487 488; PR 8247489%struct.S1 = type { i8, i8 }490@func_89.l_245 = internal constant %struct.S1 { i8 33, i8 6 }, align 1491define void @func_89(i16 zeroext %p_90, ptr nocapture %p_91, ptr nocapture %p_92) nounwind ssp {492entry:493  store i32 0, ptr %p_92, align 4494  br i1 false, label %lbl_260, label %if.else495 496if.else:                                          ; preds = %entry497  br label %for.cond498 499for.cond:                                         ; preds = %lbl_260, %if.else500  %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, 256503  br i1 %tobool21, label %if.end, label %lbl_260504 505lbl_260:                                          ; preds = %for.cond, %entry506  %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, 1509  br label %for.cond510 511if.end:                                           ; preds = %for.cond512  ret void513}514 515define void @PR14233(i1 %cmp, i1 %cmp2, i1 %cmp3, i1 %cmp4) {516entry:517  br i1 %cmp, label %cond.true, label %cond.false518 519cond.true:520  br label %if.end521 522cond.false:523  br label %if.end524 525if.end:526  %A = phi i64 [ 0, %cond.true ], [ 1, %cond.false ]527  br i1 %cmp2, label %bb, label %if.end2528 529bb:530  br label %if.end2531 532if.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.end3536 537cond.true2:538  br i1 %cmp3, label %bb2, label %ur539 540bb2:541  br i1 %cmp4, label %if.end4, label %if.end3542 543if.end4:544  unreachable545 546if.end3:547  %cmp.ptr2 = icmp eq i64 %B, ptrtoint (ptr @PR14233.f2 to i64)548  br i1 %cmp.ptr2, label %ur, label %if.then601549 550if.then601:551  %C = icmp eq i64 %B, 0552  br i1 %C, label %bb3, label %bb4553 554bb3:555  unreachable556 557bb4:558  unreachable559 560ur:561  unreachable562}563 564declare ptr @PR14233.f1()565 566declare ptr @PR14233.f2()567 568; Make sure the following compiles in a sane amount of time, as opposed569; 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_loop573; CHECK: %x39 = or i1 %x38, %x38574; CHECK: br i1 %x39, label %dest1, label %dest2575define void @almost_infinite_loop(i1 %x0) {576entry:577  br label %if.then57.i578 579if.then57.i:580  %x1 = or i1 %x0, %x0581  %x2 = or i1 %x1, %x1582  %x3 = or i1 %x2, %x2583  %x4 = or i1 %x3, %x3584  %x5 = or i1 %x4, %x4585  %x6 = or i1 %x5, %x5586  %x7 = or i1 %x6, %x6587  %x8 = or i1 %x7, %x7588  %x9 = or i1 %x8, %x8589  %x10 = or i1 %x9, %x9590  %x11 = or i1 %x10, %x10591  %x12 = or i1 %x11, %x11592  %x13 = or i1 %x12, %x12593  %x14 = or i1 %x13, %x13594  %x15 = or i1 %x14, %x14595  %x16 = or i1 %x15, %x15596  %x17 = or i1 %x16, %x16597  %x18 = or i1 %x17, %x17598  %x19 = or i1 %x18, %x18599  %x20 = or i1 %x19, %x19600  %x21 = or i1 %x20, %x20601  %x22 = or i1 %x21, %x21602  %x23 = or i1 %x22, %x22603  %x24 = or i1 %x23, %x23604  %x25 = or i1 %x24, %x24605  %x26 = or i1 %x25, %x25606  %x27 = or i1 %x26, %x26607  %x28 = or i1 %x27, %x27608  %x29 = or i1 %x28, %x28609  %x30 = or i1 %x29, %x29610  %x31 = or i1 %x30, %x30611  %x32 = or i1 %x31, %x31612  %x33 = or i1 %x32, %x32613  %x34 = or i1 %x33, %x33614  %x35 = or i1 %x34, %x34615  %x36 = or i1 %x35, %x35616  %x37 = or i1 %x36, %x36617  %x38 = or i1 %x37, %x37618  %x39 = or i1 %x38, %x38619  br i1 %x39, label %dest1, label %dest2620 621dest1:622  unreachable623 624dest2:625  unreachable626}627