Home | History | Annotate | Download | only in JumpThreading
      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 
      7 define void @_ada_c35507b() {
      8 entry:
      9 	br label %bb
     10 
     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
     16 
     17 bb13:		; preds = %bb
     18 	br label %bb
     19 
     20 bb110:		; preds = %bb
     21 	%mrv_gr124 = extractvalue %struct.system__secondary_stack__mark_id %tmp120, 1		; <i64> [#uses=0]
     22 	unreachable
     23 }
     24 
     25 declare %struct.system__secondary_stack__mark_id @system__secondary_stack__ss_mark()
     26 
     27 
     28 
     29 define fastcc void @findratio(double* nocapture %res1, double* nocapture %res2) nounwind ssp {
     30 entry:
     31   br label %bb12
     32 
     33 bb6.us:                                        
     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
     38 
     39 
     40 bb12:                                            
     41   %tmp3 = fcmp ult double undef, 0.000000e+00  
     42   br label %bb13
     43 
     44 bb13:                                            
     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
     48 
     49 bb15:                                            
     50   %tmp4 = fsub double -0.000000e+00, %.lcssa31   
     51   ret void
     52 
     53 
     54 bb61:                                            
     55   ret void
     56 }
     57 
     58 
     59 ; PR5258
     60 define i32 @test(i1 %cond, i1 %cond2, i32 %a) {
     61 A:
     62   br i1 %cond, label %F, label %A1
     63 F:
     64   br label %A1
     65 
     66 A1:  
     67   %d = phi i1 [false, %A], [true, %F]
     68   %e = add i32 %a, %a
     69   br i1 %d, label %B, label %G
     70   
     71 G:
     72   br i1 %cond2, label %B, label %D
     73   
     74 B:
     75   %f = phi i32 [%e, %G], [%e, %A1]
     76   %b = add i32 0, 0
     77   switch i32 %a, label %C [
     78     i32 7, label %D
     79     i32 8, label %D
     80     i32 9, label %D
     81   ]
     82 
     83 C:
     84   br label %D
     85   
     86 D:
     87   %c = phi i32 [%e, %B], [%e, %B], [%e, %B], [%f, %C], [%e, %G]
     88   ret i32 %c
     89 E:
     90   ret i32 412
     91 }
     92 
     93 
     94 define i32 @test2() nounwind {
     95 entry:
     96         br i1 true, label %decDivideOp.exit, label %bb7.i
     97 
     98 bb7.i:          ; preds = %bb7.i, %entry
     99         br label %bb7.i
    100 
    101 decDivideOp.exit:               ; preds = %entry
    102         ret i32 undef
    103 }
    104 
    105 
    106 ; PR3298
    107 
    108 define i32 @test3(i32 %p_79, i32 %p_80) nounwind {
    109 entry:
    110 	br label %bb7
    111 
    112 bb1:		; preds = %bb2
    113 	br label %bb2
    114 
    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
    118 
    119 bb3:		; preds = %bb2
    120 	%0 = icmp eq i32 %p_80_addr.1, 0		; <i1> [#uses=1]
    121 	br i1 %0, label %bb7, label %bb6
    122 
    123 bb5:		; preds = %bb6
    124 	%1 = icmp eq i8 %l_82.0, 0		; <i1> [#uses=1]
    125 	br i1 %1, label %bb1.i, label %bb.i
    126 
    127 bb.i:		; preds = %bb5
    128 	br label %safe_div_func_char_s_s.exit
    129 
    130 bb1.i:		; preds = %bb5
    131 	br label %safe_div_func_char_s_s.exit
    132 
    133 safe_div_func_char_s_s.exit:		; preds = %bb1.i, %bb.i
    134 	br label %bb6
    135 
    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
    140 
    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
    146 
    147 bb8:		; preds = %bb7
    148 	%4 = sext i8 %l_82.1 to i32		; <i32> [#uses=0]
    149 	ret i32 0
    150 }
    151 
    152 
    153 ; PR3353
    154 
    155 define i32 @test4(i8 %X) {
    156 entry:
    157         %Y = add i8 %X, 1
    158         %Z = add i8 %Y, 1
    159         br label %bb33.i
    160 
    161 bb33.i:         ; preds = %bb33.i, %bb32.i
    162         switch i8 %Y, label %bb32.i [
    163                 i8 39, label %bb35.split.i
    164                 i8 13, label %bb33.i
    165         ]
    166 
    167 bb35.split.i:
    168         ret i32 5
    169 bb32.i:
    170         ret i32 1
    171 }
    172 
    173 
    174 define fastcc void @test5(i1 %tmp, i32 %tmp1) nounwind ssp {
    175 entry:
    176   br i1 %tmp, label %bb12, label %bb13
    177 
    178 
    179 bb12:                                            
    180   br label %bb13
    181 
    182 bb13:                                            
    183   %.lcssa31 = phi i32 [ undef, %bb12 ], [ %tmp1, %entry ]
    184   %A = and i1 undef, undef
    185   br i1 %A, label %bb15, label %bb61
    186 
    187 bb15:                                            
    188   ret void
    189 
    190 
    191 bb61:                                            
    192   ret void
    193 }
    194 
    195 
    196 ; PR5640
    197 define fastcc void @test6(i1 %tmp, i1 %tmp1) nounwind ssp {
    198 entry:
    199   br i1 %tmp, label %bb12, label %bb14
    200 
    201 bb12:           
    202   br label %bb14
    203 
    204 bb14:           
    205   %A = phi i1 [ %A, %bb13 ],  [ true, %bb12 ], [%tmp1, %entry]
    206   br label %bb13
    207 
    208 bb13:                                            
    209   br i1 %A, label %bb14, label %bb61
    210 
    211 
    212 bb61:                                            
    213   ret void
    214 }
    215 
    216 
    217 ; PR5698
    218 define void @test7(i32 %x) {
    219 entry:
    220   br label %tailrecurse
    221 
    222 tailrecurse:
    223   switch i32 %x, label %return [
    224     i32 2, label %bb2
    225     i32 3, label %bb
    226   ]
    227 
    228 bb:         
    229   switch i32 %x, label %return [
    230     i32 2, label %bb2
    231     i32 3, label %tailrecurse
    232   ]
    233 
    234 bb2:        
    235   ret void
    236 
    237 return:     
    238   ret void
    239 }
    240 
    241 ; PR6119
    242 define i32 @test8(i32 %action) nounwind {
    243 entry:
    244   switch i32 %action, label %lor.rhs [
    245     i32 1, label %if.then
    246     i32 0, label %lor.end
    247   ]
    248 
    249 if.then:                                          ; preds = %for.cond, %lor.end, %entry
    250   ret i32 undef
    251 
    252 lor.rhs:                                          ; preds = %entry
    253   br label %lor.end
    254 
    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
    258 
    259 for.cond:                                         ; preds = %for.body, %lor.end
    260   br i1 undef, label %if.then, label %for.body
    261 
    262 for.body:                                         ; preds = %for.cond
    263   br label %for.cond
    264 }
    265 
    266 ; PR6119
    267 define i32 @test9(i32 %action) nounwind {
    268 entry:
    269   switch i32 %action, label %lor.rhs [
    270     i32 1, label %if.then
    271     i32 0, label %lor.end
    272   ]
    273 
    274 if.then:                                          ; preds = %for.cond, %lor.end, %entry
    275   ret i32 undef
    276 
    277 lor.rhs:                                          ; preds = %entry
    278   br label %lor.end
    279 
    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
    284 
    285 for.cond:                                         ; preds = %for.body, %lor.end
    286   br i1 undef, label %if.then, label %for.body
    287 
    288 for.body:                                         ; preds = %for.cond
    289   br label %for.cond
    290 }
    291 
    292 ; PR6119
    293 define i32 @test10(i32 %action, i32 %type) nounwind {
    294 entry:
    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
    299   ]
    300 
    301 if.then:                                          ; preds = %for.cond, %lor.end, %entry
    302   ret i32 undef
    303 
    304 lor.rhs:                                          ; preds = %entry
    305   %cmp101 = icmp eq i32 %action, 2                ; <i1> [#uses=1]
    306   br label %lor.end
    307 
    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
    312 
    313 for.cond:                                         ; preds = %for.body, %lor.end
    314   br i1 undef, label %if.then, label %for.body
    315 
    316 for.body:                                         ; preds = %for.cond
    317   br label %for.cond
    318 }
    319 
    320 
    321 ; PR6305
    322 define void @test11() nounwind {
    323 entry:
    324   br label %A
    325 
    326 A:                                             ; preds = %entry
    327   call void undef(i64 ptrtoint (i8* blockaddress(@test11, %A) to i64)) nounwind
    328   unreachable
    329 }
    330 
    331 ; PR6743
    332 define void @test12() nounwind ssp {
    333 entry:
    334   br label %lbl_51
    335 
    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
    339 
    340 if.then:                                          ; preds = %lbl_51
    341   br i1 %tmp3, label %lbl_51, label %if.end12
    342 
    343 if.end12:                                         ; preds = %if.then, %lbl_51
    344   ret void
    345 }
    346 
    347 
    348 
    349 ; PR7356
    350 define i32 @test13(i32* %P, i8* %Ptr) {
    351 entry:
    352   indirectbr i8* %Ptr, [label %BrBlock, label %B2]
    353   
    354 B2:
    355   store i32 4, i32 *%P
    356   br label %BrBlock
    357 
    358 BrBlock:
    359   %L = load i32* %P
    360   %C = icmp eq i32 %L, 42
    361   br i1 %C, label %T, label %F
    362   
    363 T:
    364   ret i32 123
    365 F:
    366   ret i32 1422
    367 }
    368 
    369 
    370 ; PR7498
    371 define void @test14() nounwind {
    372 entry:
    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
    376 
    377 land.rhs:                                         ; preds = %entry
    378   br label %land.end69
    379 
    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
    385 
    386 if.then:                                          ; preds = %land.end69
    387   ret void
    388 
    389 if.end:                                           ; preds = %land.end69
    390   ret void
    391 }
    392 
    393 ; PR7647
    394 define void @test15() nounwind {
    395 entry:
    396   ret void
    397   
    398 if.then237:
    399   br label %lbl_664
    400 
    401 lbl_596:                                          ; preds = %lbl_664, %for.end37
    402   volatile store i64 undef, i64* undef, align 4
    403   br label %for.cond111
    404 
    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
    410 
    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
    415 
    416 cond.true.i100:                                   ; preds = %for.inc120
    417   br label %for.cond111
    418 
    419 lbl_709:
    420   br label %if.end949
    421   
    422 for.cond603:                                      ; preds = %for.body607, %if.end336
    423   br i1 undef, label %for.cond603, label %if.end949
    424 
    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
    428 
    429 for.body1016:                                     ; preds = %for.cond1012
    430   br label %for.body1016
    431 
    432 for.cond1035:                                     ; preds = %for.inc1055, %if.then1026
    433   br i1 undef, label %for.cond1040, label %lbl_664
    434 
    435 for.cond1040:                                     ; preds = %for.body1044, %for.cond1035
    436   ret void
    437 }
    438 
    439 ; PR7755
    440 define void @test16(i1 %c, i1 %c2, i1 %c3, i1 %c4) nounwind ssp {
    441 entry:
    442   %cmp = icmp sgt i32 undef, 1                    ; <i1> [#uses=1]
    443   br i1 %c, label %land.end, label %land.rhs
    444 
    445 land.rhs:                                         ; preds = %entry
    446   br i1 %c2, label %lor.lhs.false.i, label %land.end
    447 
    448 lor.lhs.false.i:                                  ; preds = %land.rhs
    449   br i1 %c3, label %land.end, label %land.end
    450 
    451 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
    456 
    457 if.then:                      
    458   ret void
    459 
    460 if.end:                       
    461   ret void
    462 }
    463 
    464 define void @test17() {
    465 entry:
    466   br i1 undef, label %bb269.us.us, label %bb269.us.us.us
    467 
    468 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
    472 
    473 bb287.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
    477 
    478 bb286.us.us.us:
    479   unreachable
    480 
    481 bb269.us.us:
    482 	unreachable
    483 
    484 bb288.bb289.loopexit_crit_edge:
    485   unreachable
    486 }
    487 
    488 ; PR 8247
    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, %struct.S1* nocapture %p_91, i32* nocapture %p_92) nounwind ssp {
    492 entry:
    493   store i32 0, i32* %p_92, align 4
    494   br i1 false, label %lbl_260, label %if.else
    495 
    496 if.else:                                          ; preds = %entry
    497   br label %for.cond
    498 
    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
    504 
    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
    509   br label %for.cond
    510 
    511 if.end:                                           ; preds = %for.cond
    512   ret void
    513 }
    514