1; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mcpu=cortex-a8 -disable-cgp-branch-opts | FileCheck %s
2
3%struct.pix_pos = type { i32, i32, i32, i32, i32, i32 }
4
5@getNeighbour = external global void (i32, i32, i32, i32, %struct.pix_pos*)*, align 4 ; <void (i32, i32, i32, i32, %struct.pix_pos*)**> [#uses=2]
6
7define void @t() nounwind {
8; CHECK-LABEL: t:
9; CHECK:      it eq
10; CHECK-NEXT: cmpeq
11entry:
12  %pix_a.i294 = alloca [4 x %struct.pix_pos], align 4 ; <[4 x %struct.pix_pos]*> [#uses=2]
13  br i1 undef, label %land.rhs, label %lor.end
14
15land.rhs:                                         ; preds = %entry
16  br label %lor.end
17
18lor.end:                                          ; preds = %land.rhs, %entry
19  switch i32 0, label %if.end371 [
20    i32 10, label %if.then366
21    i32 14, label %if.then366
22  ]
23
24if.then366:                                       ; preds = %lor.end, %lor.end
25  unreachable
26
27if.end371:                                        ; preds = %lor.end
28  %arrayidx56.2.i = getelementptr [4 x %struct.pix_pos]* %pix_a.i294, i32 0, i32 2 ; <%struct.pix_pos*> [#uses=1]
29  %arrayidx56.3.i = getelementptr [4 x %struct.pix_pos]* %pix_a.i294, i32 0, i32 3 ; <%struct.pix_pos*> [#uses=1]
30  br i1 undef, label %for.body1857, label %for.end4557
31
32for.body1857:                                     ; preds = %if.end371
33  br i1 undef, label %if.then1867, label %for.cond1933
34
35if.then1867:                                      ; preds = %for.body1857
36  unreachable
37
38for.cond1933:                                     ; preds = %for.body1857
39  br i1 undef, label %for.body1940, label %if.then4493
40
41for.body1940:                                     ; preds = %for.cond1933
42  %shl = shl i32 undef, 2                         ; <i32> [#uses=1]
43  %shl1959 = shl i32 undef, 2                     ; <i32> [#uses=4]
44  br i1 undef, label %if.then1992, label %if.else2003
45
46if.then1992:                                      ; preds = %for.body1940
47  %tmp14.i302 = load i32* undef                   ; <i32> [#uses=4]
48  %add.i307452 = or i32 %shl1959, 1               ; <i32> [#uses=1]
49  %sub.i308 = add i32 %shl, -1                    ; <i32> [#uses=4]
50  call  void undef(i32 %tmp14.i302, i32 %sub.i308, i32 %shl1959, i32 0, %struct.pix_pos* undef) nounwind
51  %tmp49.i309 = load void (i32, i32, i32, i32, %struct.pix_pos*)** @getNeighbour ; <void (i32, i32, i32, i32, %struct.pix_pos*)*> [#uses=1]
52  call  void %tmp49.i309(i32 %tmp14.i302, i32 %sub.i308, i32 %add.i307452, i32 0, %struct.pix_pos* null) nounwind
53  %tmp49.1.i = load void (i32, i32, i32, i32, %struct.pix_pos*)** @getNeighbour ; <void (i32, i32, i32, i32, %struct.pix_pos*)*> [#uses=1]
54  call  void %tmp49.1.i(i32 %tmp14.i302, i32 %sub.i308, i32 undef, i32 0, %struct.pix_pos* %arrayidx56.2.i) nounwind
55  call  void undef(i32 %tmp14.i302, i32 %sub.i308, i32 undef, i32 0, %struct.pix_pos* %arrayidx56.3.i) nounwind
56  unreachable
57
58if.else2003:                                      ; preds = %for.body1940
59  switch i32 undef, label %if.then2015 [
60    i32 10, label %if.then4382
61    i32 14, label %if.then4382
62  ]
63
64if.then2015:                                      ; preds = %if.else2003
65  br i1 undef, label %if.else2298, label %if.then2019
66
67if.then2019:                                      ; preds = %if.then2015
68  br i1 undef, label %if.then2065, label %if.else2081
69
70if.then2065:                                      ; preds = %if.then2019
71  br label %if.end2128
72
73if.else2081:                                      ; preds = %if.then2019
74  br label %if.end2128
75
76if.end2128:                                       ; preds = %if.else2081, %if.then2065
77  unreachable
78
79if.else2298:                                      ; preds = %if.then2015
80  br i1 undef, label %land.lhs.true2813, label %cond.end2841
81
82land.lhs.true2813:                                ; preds = %if.else2298
83  br i1 undef, label %cond.end2841, label %cond.true2824
84
85cond.true2824:                                    ; preds = %land.lhs.true2813
86  br label %cond.end2841
87
88cond.end2841:                                     ; preds = %cond.true2824, %land.lhs.true2813, %if.else2298
89  br i1 undef, label %for.cond2882.preheader, label %for.cond2940.preheader
90
91for.cond2882.preheader:                           ; preds = %cond.end2841
92  %mul3693 = shl i32 undef, 1                     ; <i32> [#uses=2]
93  br i1 undef, label %if.then3689, label %if.else3728
94
95for.cond2940.preheader:                           ; preds = %cond.end2841
96  br label %for.inc3040
97
98for.inc3040:                                      ; preds = %for.inc3040, %for.cond2940.preheader
99  br label %for.inc3040
100
101if.then3689:                                      ; preds = %for.cond2882.preheader
102  %add3695 = add nsw i32 %mul3693, %shl1959       ; <i32> [#uses=1]
103  %mul3697 = shl i32 %add3695, 2                  ; <i32> [#uses=2]
104  %arrayidx3705 = getelementptr inbounds i16* undef, i32 1 ; <i16*> [#uses=1]
105  %tmp3706 = load i16* %arrayidx3705              ; <i16> [#uses=1]
106  %conv3707 = sext i16 %tmp3706 to i32            ; <i32> [#uses=1]
107  %add3708 = add nsw i32 %conv3707, %mul3697      ; <i32> [#uses=1]
108  %arrayidx3724 = getelementptr inbounds i16* null, i32 1 ; <i16*> [#uses=1]
109  %tmp3725 = load i16* %arrayidx3724              ; <i16> [#uses=1]
110  %conv3726 = sext i16 %tmp3725 to i32            ; <i32> [#uses=1]
111  %add3727 = add nsw i32 %conv3726, %mul3697      ; <i32> [#uses=1]
112  br label %if.end3770
113
114if.else3728:                                      ; preds = %for.cond2882.preheader
115  %mul3733 = add i32 %shl1959, 1073741816         ; <i32> [#uses=1]
116  %add3735 = add nsw i32 %mul3733, %mul3693       ; <i32> [#uses=1]
117  %mul3737 = shl i32 %add3735, 2                  ; <i32> [#uses=2]
118  %tmp3746 = load i16* undef                      ; <i16> [#uses=1]
119  %conv3747 = sext i16 %tmp3746 to i32            ; <i32> [#uses=1]
120  %add3748 = add nsw i32 %conv3747, %mul3737      ; <i32> [#uses=1]
121  %arrayidx3765 = getelementptr inbounds i16* null, i32 1 ; <i16*> [#uses=1]
122  %tmp3766 = load i16* %arrayidx3765              ; <i16> [#uses=1]
123  %conv3767 = sext i16 %tmp3766 to i32            ; <i32> [#uses=1]
124  %add3768 = add nsw i32 %conv3767, %mul3737      ; <i32> [#uses=1]
125  br label %if.end3770
126
127if.end3770:                                       ; preds = %if.else3728, %if.then3689
128  %vec2_y.1 = phi i32 [ %add3727, %if.then3689 ], [ %add3768, %if.else3728 ] ; <i32> [#uses=0]
129  %vec1_y.2 = phi i32 [ %add3708, %if.then3689 ], [ %add3748, %if.else3728 ] ; <i32> [#uses=0]
130  unreachable
131
132if.then4382:                                      ; preds = %if.else2003, %if.else2003
133  switch i32 undef, label %if.then4394 [
134    i32 10, label %if.else4400
135    i32 14, label %if.else4400
136  ]
137
138if.then4394:                                      ; preds = %if.then4382
139  unreachable
140
141if.else4400:                                      ; preds = %if.then4382, %if.then4382
142  br label %for.cond4451.preheader
143
144for.cond4451.preheader:                           ; preds = %for.cond4451.preheader, %if.else4400
145  br label %for.cond4451.preheader
146
147if.then4493:                                      ; preds = %for.cond1933
148  unreachable
149
150for.end4557:                                      ; preds = %if.end371
151  ret void
152}
153