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