1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 &&
2 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'b LBB.*' | wc -l | grep 5
3 ;;; FIXME, 4 unconditional branches is minimal
6 target pointersize = 32
7 target triple = "powerpc-apple-darwin8.7.0"
9 implementation ; Functions:
11 void %foo(int %W, int %X, int %Y, int %Z) {
13 %X = cast int %X to uint ; <uint> [#uses=1]
14 %Y = cast int %Y to uint ; <uint> [#uses=1]
15 %Z = cast int %Z to uint ; <uint> [#uses=1]
16 %W = cast int %W to uint ; <uint> [#uses=1]
17 %tmp1 = and int %W, 1 ; <int> [#uses=1]
18 %tmp1 = seteq int %tmp1, 0 ; <bool> [#uses=1]
19 br bool %tmp1, label %cond_false, label %bb5
21 bb: ; preds = %bb5, %bb
22 %indvar77 = phi uint [ %indvar.next78, %bb ], [ 0, %bb5 ] ; <uint> [#uses=1]
23 %tmp2 = tail call int (...)* %bar( ) ; <int> [#uses=0]
24 %indvar.next78 = add uint %indvar77, 1 ; <uint> [#uses=2]
25 %exitcond79 = seteq uint %indvar.next78, %X ; <bool> [#uses=1]
26 br bool %exitcond79, label %cond_next48, label %bb
29 %tmp = seteq int %X, 0 ; <bool> [#uses=1]
30 br bool %tmp, label %cond_next48, label %bb
32 cond_false: ; preds = %entry
33 %tmp10 = and int %W, 2 ; <int> [#uses=1]
34 %tmp10 = seteq int %tmp10, 0 ; <bool> [#uses=1]
35 br bool %tmp10, label %cond_false20, label %bb16
37 bb12: ; preds = %bb16, %bb12
38 %indvar72 = phi uint [ %indvar.next73, %bb12 ], [ 0, %bb16 ] ; <uint> [#uses=1]
39 %tmp13 = tail call int (...)* %bar( ) ; <int> [#uses=0]
40 %indvar.next73 = add uint %indvar72, 1 ; <uint> [#uses=2]
41 %exitcond74 = seteq uint %indvar.next73, %Y ; <bool> [#uses=1]
42 br bool %exitcond74, label %cond_next48, label %bb12
44 bb16: ; preds = %cond_false
45 %tmp18 = seteq int %Y, 0 ; <bool> [#uses=1]
46 br bool %tmp18, label %cond_next48, label %bb12
48 cond_false20: ; preds = %cond_false
49 %tmp23 = and int %W, 4 ; <int> [#uses=1]
50 %tmp23 = seteq int %tmp23, 0 ; <bool> [#uses=1]
51 br bool %tmp23, label %cond_false33, label %bb29
53 bb25: ; preds = %bb29, %bb25
54 %indvar67 = phi uint [ %indvar.next68, %bb25 ], [ 0, %bb29 ] ; <uint> [#uses=1]
55 %tmp26 = tail call int (...)* %bar( ) ; <int> [#uses=0]
56 %indvar.next68 = add uint %indvar67, 1 ; <uint> [#uses=2]
57 %exitcond69 = seteq uint %indvar.next68, %Z ; <bool> [#uses=1]
58 br bool %exitcond69, label %cond_next48, label %bb25
60 bb29: ; preds = %cond_false20
61 %tmp31 = seteq int %Z, 0 ; <bool> [#uses=1]
62 br bool %tmp31, label %cond_next48, label %bb25
64 cond_false33: ; preds = %cond_false20
65 %tmp36 = and int %W, 8 ; <int> [#uses=1]
66 %tmp36 = seteq int %tmp36, 0 ; <bool> [#uses=1]
67 br bool %tmp36, label %cond_next48, label %bb42
70 %tmp39 = tail call int (...)* %bar( ) ; <int> [#uses=0]
71 %indvar.next = add uint %indvar, 1 ; <uint> [#uses=1]
74 bb42: ; preds = %cond_false33, %bb38
75 %indvar = phi uint [ %indvar.next, %bb38 ], [ 0, %cond_false33 ] ; <uint> [#uses=3]
76 %indvar = cast uint %indvar to int ; <int> [#uses=1]
77 %W_addr.0 = sub int %W, %indvar ; <int> [#uses=1]
78 %exitcond = seteq uint %indvar, %W ; <bool> [#uses=1]
79 br bool %exitcond, label %cond_next48, label %bb38
81 cond_next48: ; preds = %bb, %bb12, %bb25, %bb42, %cond_false33, %bb29, %bb16, %bb5
82 %W_addr.1 = phi int [ %W, %bb5 ], [ %W, %bb16 ], [ %W, %bb29 ], [ %W, %cond_false33 ], [ %W_addr.0, %bb42 ], [ %W, %bb25 ], [ %W, %bb12 ], [ %W, %bb ] ; <int> [#uses=1]
83 %tmp50 = seteq int %W_addr.1, 0 ; <bool> [#uses=1]
84 br bool %tmp50, label %UnifiedReturnBlock, label %cond_true51
86 cond_true51: ; preds = %cond_next48
87 %tmp52 = tail call int (...)* %bar( ) ; <int> [#uses=0]
90 UnifiedReturnBlock: ; preds = %cond_next48