Home | History | Annotate | Download | only in LoopSimplify
      1 ; RUN: opt < %s -loop-simplify -lcssa -verify-loop-info -verify-dom-info -S \
      2 ; RUN:   | grep -F {indirectbr i8* %x, \[label %L0, label %L1\]} \
      3 ; RUN:   | count 6
      4 
      5 ; LoopSimplify should not try to transform loops when indirectbr is involved.
      6 
      7 define void @entry(i8* %x) {
      8 entry:
      9   indirectbr i8* %x, [ label %L0, label %L1 ]
     10 
     11 L0:
     12   br label %L0
     13 
     14 L1:
     15   ret void
     16 }
     17 
     18 define void @backedge(i8* %x) {
     19 entry:
     20   br label %L0
     21 
     22 L0:
     23   br label %L1
     24 
     25 L1:
     26   indirectbr i8* %x, [ label %L0, label %L1 ]
     27 }
     28 
     29 define i64 @exit(i8* %x) {
     30 entry:
     31   br label %L2
     32 
     33 L2:
     34   %z = bitcast i64 0 to i64
     35   indirectbr i8* %x, [ label %L0, label %L1 ]
     36 
     37 L0:
     38   br label %L2
     39 
     40 L1:
     41   ret i64 %z
     42 }
     43 
     44 define i64 @criticalexit(i8* %x, i1 %a) {
     45 entry:
     46   br i1 %a, label %L1, label %L2
     47 
     48 L2:
     49   %z = bitcast i64 0 to i64
     50   indirectbr i8* %x, [ label %L0, label %L1 ]
     51 
     52 L0:
     53   br label %L2
     54 
     55 L1:
     56   %y = phi i64 [ %z, %L2 ], [ 1, %entry ]
     57   ret i64 %y
     58 }
     59 
     60 define i64 @exit_backedge(i8* %x) {
     61 entry:
     62   br label %L0
     63 
     64 L0:
     65   %z = bitcast i64 0 to i64
     66   indirectbr i8* %x, [ label %L0, label %L1 ]
     67 
     68 L1:
     69   ret i64 %z
     70 }
     71 
     72 define i64 @criticalexit_backedge(i8* %x, i1 %a) {
     73 entry:
     74   br i1 %a, label %L0, label %L1
     75 
     76 L0:
     77   %z = bitcast i64 0 to i64
     78   indirectbr i8* %x, [ label %L0, label %L1 ]
     79 
     80 L1:
     81   %y = phi i64 [ %z, %L0 ], [ 1, %entry ]
     82   ret i64 %y
     83 }
     84 
     85 define void @pr5502() nounwind {
     86 entry:
     87   br label %while.cond
     88 
     89 while.cond:
     90   br i1 undef, label %while.body, label %while.end
     91 
     92 while.body:
     93   indirectbr i8* undef, [label %end_opcode, label %end_opcode]
     94 
     95 end_opcode:
     96   br i1 false, label %end_opcode, label %while.cond
     97 
     98 while.end:
     99   ret void
    100 }
    101