Home | History | Annotate | Download | only in IndVarSimplify
      1 ; RUN: opt -indvars -disable-output < %s
      2 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"
      3 
      4 declare i32 @putchar(i8) nounwind
      5 
      6 define void @t2(i1* %P) nounwind {
      7 ; <label>:0
      8   br label %1
      9 
     10 ; <label>:1                                       ; preds = %1, %0
     11   %2 = phi double [ 9.000000e+00, %0 ], [ %4, %1 ] ; <double> [#uses=1]
     12   %3 = tail call i32 @putchar(i8 72)              ; <i32> [#uses=0]
     13   %4 = fadd double %2, -1.000000e+00              ; <double> [#uses=2]
     14   %5 = fcmp ult double %4, 0.000000e+00           ; <i1> [#uses=1]
     15   store i1 %5, i1* %P
     16   br i1 %5, label %6, label %1
     17 
     18 ; <label>:6                                       ; preds = %1
     19   ret void
     20 }
     21 
     22 ; PR7562
     23 define void @fannkuch() nounwind {
     24 entry:                                              ; preds = %entry
     25   br label %bb12
     26 
     27 bb12:                                             ; preds = %bb29, %entry
     28   %i.1 = phi i32 [ undef, %entry ], [ %i.0, %bb29 ] ; <i32> [#uses=2]
     29   %r.1 = phi i32 [ undef, %entry ], [ %r.0, %bb29 ] ; <i32> [#uses=2]
     30   br i1 undef, label %bb13, label %bb24
     31 
     32 bb13:                                             ; preds = %bb12
     33   br label %bb24
     34 
     35 bb24:                                             ; preds = %bb30, %bb13, %bb12
     36   %i.2 = phi i32 [ %i.1, %bb13 ], [ %i.0, %bb30 ], [ %i.1, %bb12 ] ; <i32> [#uses=1]
     37   %r.0 = phi i32 [ %r.1, %bb13 ], [ %2, %bb30 ], [ %r.1, %bb12 ] ; <i32> [#uses=3]
     38   br label %bb28
     39 
     40 bb27:                                             ; preds = %bb28
     41   %0 = add nsw i32 %i.0, 1                        ; <i32> [#uses=1]
     42   br label %bb28
     43 
     44 bb28:                                             ; preds = %bb27, %bb26
     45   %i.0 = phi i32 [ %i.2, %bb24 ], [ %0, %bb27 ]   ; <i32> [#uses=4]
     46   %1 = icmp slt i32 %i.0, %r.0                    ; <i1> [#uses=1]
     47   br i1 %1, label %bb27, label %bb29
     48 
     49 bb29:                                             ; preds = %bb28
     50   br i1 undef, label %bb12, label %bb30
     51 
     52 bb30:                                             ; preds = %bb29
     53   %2 = add nsw i32 %r.0, 1                        ; <i32> [#uses=1]
     54   br label %bb24
     55 }
     56 
     57 ; PR10770
     58 
     59 declare void @__go_panic() noreturn
     60 
     61 declare void @__go_undefer()
     62 
     63 declare i32 @__gccgo_personality_v0(i32, i64, i8*, i8*)
     64 
     65 define void @main.main() uwtable {
     66 entry:
     67   invoke void @__go_panic() noreturn
     68           to label %0 unwind label %"5.i"
     69 
     70 ; <label>:0                                       ; preds = %entry
     71   unreachable
     72 
     73 "3.i":                                            ; preds = %"7.i", %"5.i"
     74   invoke void @__go_undefer()
     75           to label %main.f.exit unwind label %"7.i"
     76 
     77 "5.i":                                            ; preds = %entry
     78   %1 = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gccgo_personality_v0
     79           catch i8* null
     80   br label %"3.i"
     81 
     82 "7.i":                                            ; preds = %"3.i"
     83   %2 = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gccgo_personality_v0
     84           catch i8* null
     85   br label %"3.i"
     86 
     87 main.f.exit:                                      ; preds = %"3.i"
     88   unreachable
     89 }
     90 
     91 
     92 ; PR13967
     93 
     94 define void @f() nounwind ssp {
     95 bb:
     96   br label %bb4
     97 
     98 bb4:
     99   %tmp = phi i64 [ %tmp5, %bb7 ], [ undef, %bb ]
    100   %tmp5 = add nsw i64 %tmp, 1
    101   %extract.t1 = trunc i64 %tmp5 to i32
    102   br i1 false, label %bb6, label %bb7
    103 
    104 bb6:
    105   br label %bb7
    106 
    107 bb7:
    108   %.off0 = phi i32 [ undef, %bb6 ], [ %extract.t1, %bb4 ]
    109   %tmp8 = icmp eq i32 %.off0, 0
    110   br i1 %tmp8, label %bb9, label %bb4
    111 
    112 bb9:
    113   ret void
    114 }
    115 
    116 ; PR12536
    117 define void @fn1() noreturn nounwind {
    118 entry:
    119   br label %for.cond
    120 
    121 for.cond:                                         ; preds = %for.end, %entry
    122   %b.0 = phi i32 [ undef, %entry ], [ %conv, %for.end ]
    123   br label %for.cond1
    124 
    125 for.cond1:                                        ; preds = %for.cond1, %for.cond
    126   %c.0 = phi i32 [ %b.0, %for.cond1 ], [ 0, %for.cond ]
    127   br i1 undef, label %for.cond1, label %for.end
    128 
    129 for.end:                                          ; preds = %for.cond1
    130   %cmp2 = icmp slt i32 %c.0, 1
    131   %conv = zext i1 %cmp2 to i32
    132   br label %for.cond
    133 }
    134