This implements the second half of the fix for PR3290, handling
[oota-llvm.git] / test / Transforms / InstCombine / 2006-05-06-Infloop.ll
1 ; RUN: llvm-as < %s | opt -instcombine -disable-output
2 ; END.
3         %struct.gs_matrix = type { float, i32, float, i32, float, i32, float, i32, float, i32, float, i32 }
4         %struct.gx_bitmap = type { i8*, i32, i32, i32 }
5         %struct.gx_device = type { i32, %struct.gx_device_procs*, i8*, i32, i32, float, float, i32, i16, i32, i32 }
6         %struct.gx_device_memory = type { i32, %struct.gx_device_procs*, i8*, i32, i32, float, float, i32, i16, i32, i32, %struct.gs_matrix, i32, i8*, i8**, i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)*, i32, i32, i8* }
7         %struct.gx_device_procs = type { i32 (%struct.gx_device*)*, void (%struct.gx_device*, %struct.gs_matrix*)*, i32 (%struct.gx_device*)*, i32 (%struct.gx_device*)*, i32 (%struct.gx_device*)*, i32 (%struct.gx_device*, i16, i16, i16)*, i32 (%struct.gx_device*, i32, i16*)*, i32 (%struct.gx_device*, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, %struct.gx_bitmap*, i32, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, i8*, i32, i32, i32, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, i8*, i32, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, i32, i32, i32, i32, i32, i32, i32)*, i32 (%struct.gx_device*, %struct.gx_bitmap*, i32, i32, i32, i32, i32, i32, i32, i32)* }
8
9 define i32 @mem_mono_copy_mono(%struct.gx_device* %dev, i8* %base, i32 %sourcex, i32 %raster, i32 %x, i32 %y, i32 %w, i32 %h, i32 %zero, i32 %one) {
10 entry:
11         %tmp = icmp eq i32 %one, %zero          ; <i1> [#uses=1]
12         br i1 %tmp, label %cond_true, label %cond_next
13
14 cond_true:              ; preds = %entry
15         %tmp6 = tail call i32 @mem_mono_fill_rectangle( %struct.gx_device* %dev, i32 %x, i32 %y, i32 %w, i32 %h, i32 %zero )            ; <i32> [#uses=1]
16         ret i32 %tmp6
17
18 cond_next:              ; preds = %entry
19         %tmp8 = bitcast %struct.gx_device* %dev to %struct.gx_device_memory*            ; <%struct.gx_device_memory*> [#uses=6]
20         %tmp.upgrd.1 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 15             ; <i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)**> [#uses=1]
21         %tmp.upgrd.2 = load i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)** %tmp.upgrd.1             ; <i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)*> [#uses=2]
22         %tmp9 = icmp eq i32 (%struct.gx_device_memory*, i32, i32, i32, i32, i32)* %tmp.upgrd.2, @mem_no_fault_proc              ; <i1> [#uses=1]
23         br i1 %tmp9, label %cond_next46, label %cond_true10
24
25 cond_true10:            ; preds = %cond_next
26         %tmp16 = add i32 %x, 7          ; <i32> [#uses=1]
27         %tmp17 = add i32 %tmp16, %w             ; <i32> [#uses=1]
28         %tmp18 = ashr i32 %tmp17, 3             ; <i32> [#uses=1]
29         %tmp20 = ashr i32 %x, 3         ; <i32> [#uses=2]
30         %tmp21 = sub i32 %tmp18, %tmp20         ; <i32> [#uses=1]
31         %tmp27 = tail call i32 %tmp.upgrd.2( %struct.gx_device_memory* %tmp8, i32 %tmp20, i32 %y, i32 %tmp21, i32 %h, i32 1 )           ; <i32> [#uses=2]
32         %tmp29 = icmp slt i32 %tmp27, 0         ; <i1> [#uses=1]
33         br i1 %tmp29, label %cond_true30, label %cond_next46
34
35 cond_true30:            ; preds = %cond_true10
36         %tmp41 = tail call i32 @mem_copy_mono_recover( %struct.gx_device* %dev, i8* %base, i32 %sourcex, i32 %raster, i32 %x, i32 %y, i32 %w, i32 %h, i32 %zero, i32 %one, i32 %tmp27 )         ; <i32> [#uses=1]
37         ret i32 %tmp41
38
39 cond_next46:            ; preds = %cond_true10, %cond_next
40         %tmp48 = icmp sgt i32 %w, 0             ; <i1> [#uses=1]
41         %tmp53 = icmp sgt i32 %h, 0             ; <i1> [#uses=1]
42         %bothcond = and i1 %tmp53, %tmp48               ; <i1> [#uses=1]
43         br i1 %bothcond, label %bb58, label %return
44
45 bb58:           ; preds = %cond_next46
46         %tmp60 = icmp slt i32 %x, 0             ; <i1> [#uses=1]
47         br i1 %tmp60, label %return, label %cond_next63
48
49 cond_next63:            ; preds = %bb58
50         %tmp65 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 3            ; <i32*> [#uses=1]
51         %tmp66 = load i32* %tmp65               ; <i32> [#uses=1]
52         %tmp68 = sub i32 %tmp66, %w             ; <i32> [#uses=1]
53         %tmp70 = icmp slt i32 %tmp68, %x                ; <i1> [#uses=1]
54         %tmp75 = icmp slt i32 %y, 0             ; <i1> [#uses=1]
55         %bothcond1 = or i1 %tmp70, %tmp75               ; <i1> [#uses=1]
56         br i1 %bothcond1, label %return, label %cond_next78
57
58 cond_next78:            ; preds = %cond_next63
59         %tmp80 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 4            ; <i32*> [#uses=1]
60         %tmp81 = load i32* %tmp80               ; <i32> [#uses=1]
61         %tmp83 = sub i32 %tmp81, %h             ; <i32> [#uses=1]
62         %tmp85 = icmp slt i32 %tmp83, %y                ; <i1> [#uses=1]
63         br i1 %tmp85, label %return, label %bb91
64
65 bb91:           ; preds = %cond_next78
66         %tmp93 = ashr i32 %x, 3         ; <i32> [#uses=4]
67         %tmp.upgrd.3 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 14             ; <i8***> [#uses=1]
68         %tmp.upgrd.4 = load i8*** %tmp.upgrd.3          ; <i8**> [#uses=1]
69         %tmp96 = getelementptr i8** %tmp.upgrd.4, i32 %y                ; <i8**> [#uses=4]
70         %tmp98 = load i8** %tmp96               ; <i8*> [#uses=1]
71         %tmp100 = getelementptr i8* %tmp98, i32 %tmp93          ; <i8*> [#uses=3]
72         %tmp102 = ashr i32 %sourcex, 3          ; <i32> [#uses=3]
73         %tmp106 = and i32 %sourcex, 7           ; <i32> [#uses=1]
74         %tmp107 = sub i32 8, %tmp106            ; <i32> [#uses=4]
75         %tmp109 = and i32 %x, 7         ; <i32> [#uses=3]
76         %tmp110 = sub i32 8, %tmp109            ; <i32> [#uses=8]
77         %tmp112 = sub i32 8, %tmp110            ; <i32> [#uses=1]
78         %tmp112.upgrd.5 = trunc i32 %tmp112 to i8               ; <i8> [#uses=1]
79         %shift.upgrd.6 = zext i8 %tmp112.upgrd.5 to i32         ; <i32> [#uses=1]
80         %tmp113464 = lshr i32 255, %shift.upgrd.6               ; <i32> [#uses=4]
81         %tmp116 = icmp sgt i32 %tmp110, %w              ; <i1> [#uses=1]
82         %tmp132 = getelementptr %struct.gx_device_memory* %tmp8, i32 0, i32 16          ; <i32*> [#uses=2]
83         br i1 %tmp116, label %cond_true117, label %cond_false123
84
85 cond_true117:           ; preds = %bb91
86         %tmp119 = trunc i32 %w to i8            ; <i8> [#uses=1]
87         %shift.upgrd.7 = zext i8 %tmp119 to i32         ; <i32> [#uses=1]
88         %tmp120 = lshr i32 %tmp113464, %shift.upgrd.7           ; <i32> [#uses=1]
89         %tmp122 = sub i32 %tmp113464, %tmp120           ; <i32> [#uses=2]
90         %tmp13315 = load i32* %tmp132           ; <i32> [#uses=1]
91         %tmp13416 = icmp eq i32 %tmp13315, 0            ; <i1> [#uses=1]
92         br i1 %tmp13416, label %cond_next151, label %cond_true135
93
94 cond_false123:          ; preds = %bb91
95         %tmp126 = sub i32 %w, %tmp110           ; <i32> [#uses=1]
96         %tmp126.upgrd.8 = trunc i32 %tmp126 to i8               ; <i8> [#uses=1]
97         %tmp127 = and i8 %tmp126.upgrd.8, 7             ; <i8> [#uses=1]
98         %shift.upgrd.9 = zext i8 %tmp127 to i32         ; <i32> [#uses=1]
99         %tmp128 = lshr i32 255, %shift.upgrd.9          ; <i32> [#uses=1]
100         %tmp1295 = sub i32 255, %tmp128         ; <i32> [#uses=2]
101         %tmp133 = load i32* %tmp132             ; <i32> [#uses=1]
102         %tmp134 = icmp eq i32 %tmp133, 0                ; <i1> [#uses=1]
103         br i1 %tmp134, label %cond_next151, label %cond_true135
104
105 cond_true135:           ; preds = %cond_false123, %cond_true117
106         %rmask.0.0 = phi i32 [ undef, %cond_true117 ], [ %tmp1295, %cond_false123 ]             ; <i32> [#uses=2]
107         %mask.1.0 = phi i32 [ %tmp122, %cond_true117 ], [ %tmp113464, %cond_false123 ]          ; <i32> [#uses=2]
108         %not.tmp137 = icmp ne i32 %zero, -1             ; <i1> [#uses=1]
109         %tmp140 = zext i1 %not.tmp137 to i32            ; <i32> [#uses=1]
110         %zero_addr.0 = xor i32 %tmp140, %zero           ; <i32> [#uses=2]
111         %tmp144 = icmp eq i32 %one, -1          ; <i1> [#uses=1]
112         br i1 %tmp144, label %cond_next151, label %cond_true145
113
114 cond_true145:           ; preds = %cond_true135
115         %tmp147 = xor i32 %one, 1               ; <i32> [#uses=1]
116         br label %cond_next151
117
118 cond_next151:           ; preds = %cond_true145, %cond_true135, %cond_false123, %cond_true117
119         %rmask.0.1 = phi i32 [ %rmask.0.0, %cond_true145 ], [ undef, %cond_true117 ], [ %tmp1295, %cond_false123 ], [ %rmask.0.0, %cond_true135 ]               ; <i32> [#uses=4]
120         %mask.1.1 = phi i32 [ %mask.1.0, %cond_true145 ], [ %tmp122, %cond_true117 ], [ %tmp113464, %cond_false123 ], [ %mask.1.0, %cond_true135 ]              ; <i32> [#uses=4]
121         %one_addr.0 = phi i32 [ %tmp147, %cond_true145 ], [ %one, %cond_true117 ], [ %one, %cond_false123 ], [ %one, %cond_true135 ]            ; <i32> [#uses=2]
122         %zero_addr.1 = phi i32 [ %zero_addr.0, %cond_true145 ], [ %zero, %cond_true117 ], [ %zero, %cond_false123 ], [ %zero_addr.0, %cond_true135 ]            ; <i32> [#uses=2]
123         %tmp153 = icmp eq i32 %zero_addr.1, 1           ; <i1> [#uses=2]
124         %tmp158 = icmp eq i32 %one_addr.0, 0            ; <i1> [#uses=2]
125         %bothcond2 = or i1 %tmp153, %tmp158             ; <i1> [#uses=1]
126         %iftmp.35.0 = select i1 %bothcond2, i32 -1, i32 0               ; <i32> [#uses=9]
127         %tmp167 = icmp eq i32 %zero_addr.1, 0           ; <i1> [#uses=1]
128         %bothcond3 = or i1 %tmp167, %tmp158             ; <i1> [#uses=1]
129         %iftmp.36.0 = select i1 %bothcond3, i32 0, i32 -1               ; <i32> [#uses=4]
130         %tmp186 = icmp eq i32 %one_addr.0, 1            ; <i1> [#uses=1]
131         %bothcond4 = or i1 %tmp153, %tmp186             ; <i1> [#uses=1]
132         %iftmp.37.0 = select i1 %bothcond4, i32 -1, i32 0               ; <i32> [#uses=6]
133         %tmp196 = icmp eq i32 %tmp107, %tmp110          ; <i1> [#uses=1]
134         br i1 %tmp196, label %cond_true197, label %cond_false299
135
136 cond_true197:           ; preds = %cond_next151
137         %tmp29222 = add i32 %h, -1              ; <i32> [#uses=3]
138         %tmp29424 = icmp slt i32 %tmp29222, 0           ; <i1> [#uses=1]
139         br i1 %tmp29424, label %return, label %cond_true295.preheader
140
141 cond_true249.preheader:         ; preds = %cond_true295
142         br label %cond_true249
143
144 cond_true249:           ; preds = %cond_true249, %cond_true249.preheader
145         %indvar = phi i32 [ 0, %cond_true249.preheader ], [ %indvar.next, %cond_true249 ]               ; <i32> [#uses=3]
146         %optr.3.2 = phi i8* [ %tmp232.upgrd.12, %cond_true249 ], [ %dest.1.0, %cond_true249.preheader ]         ; <i8*> [#uses=1]
147         %bptr.3.2 = phi i8* [ %tmp226.upgrd.10, %cond_true249 ], [ %line.1.0, %cond_true249.preheader ]         ; <i8*> [#uses=1]
148         %tmp. = add i32 %tmp109, %w             ; <i32> [#uses=1]
149         %tmp.58 = mul i32 %indvar, -8           ; <i32> [#uses=1]
150         %tmp.57 = add i32 %tmp., -16            ; <i32> [#uses=1]
151         %tmp246.2 = add i32 %tmp.58, %tmp.57            ; <i32> [#uses=1]
152         %tmp225 = ptrtoint i8* %bptr.3.2 to i32         ; <i32> [#uses=1]
153         %tmp226 = add i32 %tmp225, 1            ; <i32> [#uses=1]
154         %tmp226.upgrd.10 = inttoptr i32 %tmp226 to i8*          ; <i8*> [#uses=3]
155         %tmp228 = load i8* %tmp226.upgrd.10             ; <i8> [#uses=1]
156         %tmp228.upgrd.11 = zext i8 %tmp228 to i32               ; <i32> [#uses=1]
157         %tmp230 = xor i32 %tmp228.upgrd.11, %iftmp.35.0         ; <i32> [#uses=2]
158         %tmp231 = ptrtoint i8* %optr.3.2 to i32         ; <i32> [#uses=1]
159         %tmp232 = add i32 %tmp231, 1            ; <i32> [#uses=1]
160         %tmp232.upgrd.12 = inttoptr i32 %tmp232 to i8*          ; <i8*> [#uses=4]
161         %tmp235 = or i32 %tmp230, %iftmp.36.0           ; <i32> [#uses=1]
162         %tmp235.upgrd.13 = trunc i32 %tmp235 to i8              ; <i8> [#uses=1]
163         %tmp237 = load i8* %tmp232.upgrd.12             ; <i8> [#uses=1]
164         %tmp238 = and i8 %tmp235.upgrd.13, %tmp237              ; <i8> [#uses=1]
165         %tmp241 = and i32 %tmp230, %iftmp.37.0          ; <i32> [#uses=1]
166         %tmp241.upgrd.14 = trunc i32 %tmp241 to i8              ; <i8> [#uses=1]
167         %tmp242 = or i8 %tmp238, %tmp241.upgrd.14               ; <i8> [#uses=1]
168         store i8 %tmp242, i8* %tmp232.upgrd.12
169         %tmp24629 = add i32 %tmp246.2, -8               ; <i32> [#uses=2]
170         %tmp24831 = icmp slt i32 %tmp24629, 0           ; <i1> [#uses=1]
171         %indvar.next = add i32 %indvar, 1               ; <i32> [#uses=1]
172         br i1 %tmp24831, label %bb252.loopexit, label %cond_true249
173
174 bb252.loopexit:         ; preds = %cond_true249
175         br label %bb252
176
177 bb252:          ; preds = %cond_true295, %bb252.loopexit
178         %optr.3.3 = phi i8* [ %dest.1.0, %cond_true295 ], [ %tmp232.upgrd.12, %bb252.loopexit ]         ; <i8*> [#uses=1]
179         %bptr.3.3 = phi i8* [ %line.1.0, %cond_true295 ], [ %tmp226.upgrd.10, %bb252.loopexit ]         ; <i8*> [#uses=1]
180         %tmp246.3 = phi i32 [ %tmp246, %cond_true295 ], [ %tmp24629, %bb252.loopexit ]          ; <i32> [#uses=1]
181         %tmp254 = icmp sgt i32 %tmp246.3, -8            ; <i1> [#uses=1]
182         br i1 %tmp254, label %cond_true255, label %cond_next280
183
184 cond_true255:           ; preds = %bb252
185         %tmp256 = ptrtoint i8* %bptr.3.3 to i32         ; <i32> [#uses=1]
186         %tmp257 = add i32 %tmp256, 1            ; <i32> [#uses=1]
187         %tmp257.upgrd.15 = inttoptr i32 %tmp257 to i8*          ; <i8*> [#uses=1]
188         %tmp259 = load i8* %tmp257.upgrd.15             ; <i8> [#uses=1]
189         %tmp259.upgrd.16 = zext i8 %tmp259 to i32               ; <i32> [#uses=1]
190         %tmp261 = xor i32 %tmp259.upgrd.16, %iftmp.35.0         ; <i32> [#uses=2]
191         %tmp262 = ptrtoint i8* %optr.3.3 to i32         ; <i32> [#uses=1]
192         %tmp263 = add i32 %tmp262, 1            ; <i32> [#uses=1]
193         %tmp263.upgrd.17 = inttoptr i32 %tmp263 to i8*          ; <i8*> [#uses=2]
194         %tmp265 = trunc i32 %tmp261 to i8               ; <i8> [#uses=1]
195         %tmp268 = or i8 %tmp266, %tmp265                ; <i8> [#uses=1]
196         %tmp270 = load i8* %tmp263.upgrd.17             ; <i8> [#uses=1]
197         %tmp271 = and i8 %tmp268, %tmp270               ; <i8> [#uses=1]
198         %tmp276 = and i32 %tmp274, %tmp261              ; <i32> [#uses=1]
199         %tmp276.upgrd.18 = trunc i32 %tmp276 to i8              ; <i8> [#uses=1]
200         %tmp277 = or i8 %tmp271, %tmp276.upgrd.18               ; <i8> [#uses=1]
201         store i8 %tmp277, i8* %tmp263.upgrd.17
202         br label %cond_next280
203
204 cond_next280:           ; preds = %cond_true255, %bb252
205         %tmp281 = ptrtoint i8** %dest_line.1.0 to i32           ; <i32> [#uses=1]
206         %tmp282 = add i32 %tmp281, 4            ; <i32> [#uses=1]
207         %tmp282.upgrd.19 = inttoptr i32 %tmp282 to i8**         ; <i8**> [#uses=2]
208         %tmp284 = load i8** %tmp282.upgrd.19            ; <i8*> [#uses=1]
209         %tmp286 = getelementptr i8* %tmp284, i32 %tmp93         ; <i8*> [#uses=1]
210         %tmp292 = add i32 %tmp292.0, -1         ; <i32> [#uses=1]
211         %tmp294 = icmp slt i32 %tmp292, 0               ; <i1> [#uses=1]
212         %indvar.next61 = add i32 %indvar60, 1           ; <i32> [#uses=1]
213         br i1 %tmp294, label %return.loopexit, label %cond_true295
214
215 cond_true295.preheader:         ; preds = %cond_true197
216         %tmp200 = sub i32 %w, %tmp110           ; <i32> [#uses=1]
217         %tmp209 = trunc i32 %mask.1.1 to i8             ; <i8> [#uses=1]
218         %tmp209not = xor i8 %tmp209, -1         ; <i8> [#uses=1]
219         %tmp212 = trunc i32 %iftmp.36.0 to i8           ; <i8> [#uses=2]
220         %tmp211 = or i8 %tmp212, %tmp209not             ; <i8> [#uses=2]
221         %tmp219 = and i32 %iftmp.37.0, %mask.1.1                ; <i32> [#uses=2]
222         %tmp246 = add i32 %tmp200, -8           ; <i32> [#uses=3]
223         %tmp248 = icmp slt i32 %tmp246, 0               ; <i1> [#uses=1]
224         %tmp264 = trunc i32 %rmask.0.1 to i8            ; <i8> [#uses=1]
225         %tmp264not = xor i8 %tmp264, -1         ; <i8> [#uses=1]
226         %tmp266 = or i8 %tmp212, %tmp264not             ; <i8> [#uses=2]
227         %tmp274 = and i32 %iftmp.37.0, %rmask.0.1               ; <i32> [#uses=2]
228         br i1 %tmp248, label %cond_true295.preheader.split.us, label %cond_true295.preheader.split
229
230 cond_true295.preheader.split.us:                ; preds = %cond_true295.preheader
231         br label %cond_true295.us
232
233 cond_true295.us:                ; preds = %cond_next280.us, %cond_true295.preheader.split.us
234         %indvar86 = phi i32 [ 0, %cond_true295.preheader.split.us ], [ %indvar.next87, %cond_next280.us ]               ; <i32> [#uses=3]
235         %dest.1.0.us = phi i8* [ %tmp286.us, %cond_next280.us ], [ %tmp100, %cond_true295.preheader.split.us ]          ; <i8*> [#uses=3]
236         %dest_line.1.0.us = phi i8** [ %tmp282.us.upgrd.21, %cond_next280.us ], [ %tmp96, %cond_true295.preheader.split.us ]            ; <i8**> [#uses=1]
237         %tmp.89 = sub i32 0, %indvar86          ; <i32> [#uses=2]
238         %tmp292.0.us = add i32 %tmp.89, %tmp29222               ; <i32> [#uses=1]
239         %tmp.91 = mul i32 %indvar86, %raster            ; <i32> [#uses=2]
240         %tmp104.sum101 = add i32 %tmp102, %tmp.91               ; <i32> [#uses=1]
241         %line.1.0.us = getelementptr i8* %base, i32 %tmp104.sum101              ; <i8*> [#uses=2]
242         %tmp.us = load i8* %line.1.0.us         ; <i8> [#uses=1]
243         %tmp206.us = zext i8 %tmp.us to i32             ; <i32> [#uses=1]
244         %tmp208.us = xor i32 %tmp206.us, %iftmp.35.0            ; <i32> [#uses=2]
245         %tmp210.us = trunc i32 %tmp208.us to i8         ; <i8> [#uses=1]
246         %tmp213.us = or i8 %tmp211, %tmp210.us          ; <i8> [#uses=1]
247         %tmp215.us = load i8* %dest.1.0.us              ; <i8> [#uses=1]
248         %tmp216.us = and i8 %tmp213.us, %tmp215.us              ; <i8> [#uses=1]
249         %tmp221.us = and i32 %tmp219, %tmp208.us                ; <i32> [#uses=1]
250         %tmp221.us.upgrd.20 = trunc i32 %tmp221.us to i8                ; <i8> [#uses=1]
251         %tmp222.us = or i8 %tmp216.us, %tmp221.us.upgrd.20              ; <i8> [#uses=1]
252         store i8 %tmp222.us, i8* %dest.1.0.us
253         br i1 true, label %bb252.us, label %cond_true249.preheader.us
254
255 cond_next280.us:                ; preds = %bb252.us, %cond_true255.us
256         %tmp281.us = ptrtoint i8** %dest_line.1.0.us to i32             ; <i32> [#uses=1]
257         %tmp282.us = add i32 %tmp281.us, 4              ; <i32> [#uses=1]
258         %tmp282.us.upgrd.21 = inttoptr i32 %tmp282.us to i8**           ; <i8**> [#uses=2]
259         %tmp284.us = load i8** %tmp282.us.upgrd.21              ; <i8*> [#uses=1]
260         %tmp286.us = getelementptr i8* %tmp284.us, i32 %tmp93           ; <i8*> [#uses=1]
261         %tmp292.us = add i32 %tmp292.0.us, -1           ; <i32> [#uses=1]
262         %tmp294.us = icmp slt i32 %tmp292.us, 0         ; <i1> [#uses=1]
263         %indvar.next87 = add i32 %indvar86, 1           ; <i32> [#uses=1]
264         br i1 %tmp294.us, label %return.loopexit.us, label %cond_true295.us
265
266 cond_true255.us:                ; preds = %bb252.us
267         %tmp256.us = ptrtoint i8* %bptr.3.3.us to i32           ; <i32> [#uses=1]
268         %tmp257.us = add i32 %tmp256.us, 1              ; <i32> [#uses=1]
269         %tmp257.us.upgrd.22 = inttoptr i32 %tmp257.us to i8*            ; <i8*> [#uses=1]
270         %tmp259.us = load i8* %tmp257.us.upgrd.22               ; <i8> [#uses=1]
271         %tmp259.us.upgrd.23 = zext i8 %tmp259.us to i32         ; <i32> [#uses=1]
272         %tmp261.us = xor i32 %tmp259.us.upgrd.23, %iftmp.35.0           ; <i32> [#uses=2]
273         %tmp262.us = ptrtoint i8* %optr.3.3.us to i32           ; <i32> [#uses=1]
274         %tmp263.us = add i32 %tmp262.us, 1              ; <i32> [#uses=1]
275         %tmp263.us.upgrd.24 = inttoptr i32 %tmp263.us to i8*            ; <i8*> [#uses=2]
276         %tmp265.us = trunc i32 %tmp261.us to i8         ; <i8> [#uses=1]
277         %tmp268.us = or i8 %tmp266, %tmp265.us          ; <i8> [#uses=1]
278         %tmp270.us = load i8* %tmp263.us.upgrd.24               ; <i8> [#uses=1]
279         %tmp271.us = and i8 %tmp268.us, %tmp270.us              ; <i8> [#uses=1]
280         %tmp276.us = and i32 %tmp274, %tmp261.us                ; <i32> [#uses=1]
281         %tmp276.us.upgrd.25 = trunc i32 %tmp276.us to i8                ; <i8> [#uses=1]
282         %tmp277.us = or i8 %tmp271.us, %tmp276.us.upgrd.25              ; <i8> [#uses=1]
283         store i8 %tmp277.us, i8* %tmp263.us.upgrd.24
284         br label %cond_next280.us
285
286 bb252.us:               ; preds = %bb252.loopexit.us, %cond_true295.us
287         %optr.3.3.us = phi i8* [ %dest.1.0.us, %cond_true295.us ], [ undef, %bb252.loopexit.us ]                ; <i8*> [#uses=1]
288         %bptr.3.3.us = phi i8* [ %line.1.0.us, %cond_true295.us ], [ undef, %bb252.loopexit.us ]                ; <i8*> [#uses=1]
289         %tmp246.3.us = phi i32 [ %tmp246, %cond_true295.us ], [ undef, %bb252.loopexit.us ]             ; <i32> [#uses=1]
290         %tmp254.us = icmp sgt i32 %tmp246.3.us, -8              ; <i1> [#uses=1]
291         br i1 %tmp254.us, label %cond_true255.us, label %cond_next280.us
292
293 cond_true249.us:                ; preds = %cond_true249.preheader.us, %cond_true249.us
294         br i1 undef, label %bb252.loopexit.us, label %cond_true249.us
295
296 cond_true249.preheader.us:              ; preds = %cond_true295.us
297         br label %cond_true249.us
298
299 bb252.loopexit.us:              ; preds = %cond_true249.us
300         br label %bb252.us
301
302 return.loopexit.us:             ; preds = %cond_next280.us
303         br label %return.loopexit.split
304
305 cond_true295.preheader.split:           ; preds = %cond_true295.preheader
306         br label %cond_true295
307
308 cond_true295:           ; preds = %cond_true295.preheader.split, %cond_next280
309         %indvar60 = phi i32 [ 0, %cond_true295.preheader.split ], [ %indvar.next61, %cond_next280 ]             ; <i32> [#uses=3]
310         %dest.1.0 = phi i8* [ %tmp286, %cond_next280 ], [ %tmp100, %cond_true295.preheader.split ]              ; <i8*> [#uses=4]
311         %dest_line.1.0 = phi i8** [ %tmp282.upgrd.19, %cond_next280 ], [ %tmp96, %cond_true295.preheader.split ]                ; <i8**> [#uses=1]
312         %tmp.63 = sub i32 0, %indvar60          ; <i32> [#uses=2]
313         %tmp292.0 = add i32 %tmp.63, %tmp29222          ; <i32> [#uses=1]
314         %tmp.65 = mul i32 %indvar60, %raster            ; <i32> [#uses=2]
315         %tmp104.sum97 = add i32 %tmp102, %tmp.65                ; <i32> [#uses=1]
316         %line.1.0 = getelementptr i8* %base, i32 %tmp104.sum97          ; <i8*> [#uses=3]
317         %tmp.upgrd.26 = load i8* %line.1.0              ; <i8> [#uses=1]
318         %tmp206 = zext i8 %tmp.upgrd.26 to i32          ; <i32> [#uses=1]
319         %tmp208 = xor i32 %tmp206, %iftmp.35.0          ; <i32> [#uses=2]
320         %tmp210 = trunc i32 %tmp208 to i8               ; <i8> [#uses=1]
321         %tmp213 = or i8 %tmp211, %tmp210                ; <i8> [#uses=1]
322         %tmp215 = load i8* %dest.1.0            ; <i8> [#uses=1]
323         %tmp216 = and i8 %tmp213, %tmp215               ; <i8> [#uses=1]
324         %tmp221 = and i32 %tmp219, %tmp208              ; <i32> [#uses=1]
325         %tmp221.upgrd.27 = trunc i32 %tmp221 to i8              ; <i8> [#uses=1]
326         %tmp222 = or i8 %tmp216, %tmp221.upgrd.27               ; <i8> [#uses=1]
327         store i8 %tmp222, i8* %dest.1.0
328         br i1 false, label %bb252, label %cond_true249.preheader
329
330 cond_false299:          ; preds = %cond_next151
331         %tmp302 = sub i32 %tmp107, %tmp110              ; <i32> [#uses=1]
332         %tmp303 = and i32 %tmp302, 7            ; <i32> [#uses=3]
333         %tmp305 = sub i32 8, %tmp303            ; <i32> [#uses=1]
334         %tmp45438 = add i32 %h, -1              ; <i32> [#uses=2]
335         %tmp45640 = icmp slt i32 %tmp45438, 0           ; <i1> [#uses=1]
336         br i1 %tmp45640, label %return, label %cond_true457.preheader
337
338 cond_true316:           ; preds = %cond_true457
339         %tmp318 = zext i8 %tmp318.upgrd.48 to i32               ; <i32> [#uses=1]
340         %shift.upgrd.28 = zext i8 %tmp319 to i32                ; <i32> [#uses=1]
341         %tmp320 = lshr i32 %tmp318, %shift.upgrd.28             ; <i32> [#uses=1]
342         br label %cond_next340
343
344 cond_false321:          ; preds = %cond_true457
345         %tmp3188 = zext i8 %tmp318.upgrd.48 to i32              ; <i32> [#uses=1]
346         %shift.upgrd.29 = zext i8 %tmp324 to i32                ; <i32> [#uses=1]
347         %tmp325 = shl i32 %tmp3188, %shift.upgrd.29             ; <i32> [#uses=2]
348         %tmp326 = ptrtoint i8* %line.3.0 to i32         ; <i32> [#uses=1]
349         %tmp327 = add i32 %tmp326, 1            ; <i32> [#uses=1]
350         %tmp327.upgrd.30 = inttoptr i32 %tmp327 to i8*          ; <i8*> [#uses=3]
351         br i1 %tmp330, label %cond_true331, label %cond_next340
352
353 cond_true331:           ; preds = %cond_false321
354         %tmp333 = load i8* %tmp327.upgrd.30             ; <i8> [#uses=1]
355         %tmp333.upgrd.31 = zext i8 %tmp333 to i32               ; <i32> [#uses=1]
356         %shift.upgrd.32 = zext i8 %tmp319 to i32                ; <i32> [#uses=1]
357         %tmp335 = lshr i32 %tmp333.upgrd.31, %shift.upgrd.32            ; <i32> [#uses=1]
358         %tmp337 = add i32 %tmp335, %tmp325              ; <i32> [#uses=1]
359         br label %cond_next340
360
361 cond_next340:           ; preds = %cond_true331, %cond_false321, %cond_true316
362         %bits.0 = phi i32 [ %tmp320, %cond_true316 ], [ %tmp337, %cond_true331 ], [ %tmp325, %cond_false321 ]           ; <i32> [#uses=1]
363         %bptr307.3 = phi i8* [ %line.3.0, %cond_true316 ], [ %tmp327.upgrd.30, %cond_true331 ], [ %tmp327.upgrd.30, %cond_false321 ]            ; <i8*> [#uses=2]
364         %tmp343 = xor i32 %bits.0, %iftmp.35.0          ; <i32> [#uses=2]
365         %tmp345 = trunc i32 %tmp343 to i8               ; <i8> [#uses=1]
366         %tmp348 = or i8 %tmp346, %tmp345                ; <i8> [#uses=1]
367         %tmp350 = load i8* %dest.3.0            ; <i8> [#uses=1]
368         %tmp351 = and i8 %tmp348, %tmp350               ; <i8> [#uses=1]
369         %tmp356 = and i32 %tmp354, %tmp343              ; <i32> [#uses=1]
370         %tmp356.upgrd.33 = trunc i32 %tmp356 to i8              ; <i8> [#uses=1]
371         %tmp357 = or i8 %tmp351, %tmp356.upgrd.33               ; <i8> [#uses=1]
372         store i8 %tmp357, i8* %dest.3.0
373         %tmp362 = ptrtoint i8* %dest.3.0 to i32         ; <i32> [#uses=1]
374         %optr309.3.in51 = add i32 %tmp362, 1            ; <i32> [#uses=2]
375         %optr309.353 = inttoptr i32 %optr309.3.in51 to i8*              ; <i8*> [#uses=2]
376         br i1 %tmp39755, label %cond_true398.preheader, label %bb401
377
378 cond_true398.preheader:         ; preds = %cond_next340
379         br label %cond_true398
380
381 cond_true398:           ; preds = %cond_true398, %cond_true398.preheader
382         %indvar66 = phi i32 [ 0, %cond_true398.preheader ], [ %indvar.next67, %cond_true398 ]           ; <i32> [#uses=4]
383         %bptr307.4.0 = phi i8* [ %tmp370.upgrd.35, %cond_true398 ], [ %bptr307.3, %cond_true398.preheader ]             ; <i8*> [#uses=2]
384         %optr309.3.0 = phi i8* [ %optr309.3, %cond_true398 ], [ %optr309.353, %cond_true398.preheader ]         ; <i8*> [#uses=2]
385         %optr309.3.in.0 = add i32 %indvar66, %optr309.3.in51            ; <i32> [#uses=1]
386         %tmp.70 = add i32 %tmp109, %w           ; <i32> [#uses=1]
387         %tmp.72 = mul i32 %indvar66, -8         ; <i32> [#uses=1]
388         %tmp.71 = add i32 %tmp.70, -8           ; <i32> [#uses=1]
389         %count308.3.0 = add i32 %tmp.72, %tmp.71                ; <i32> [#uses=1]
390         %tmp366 = load i8* %bptr307.4.0         ; <i8> [#uses=1]
391         %tmp366.upgrd.34 = zext i8 %tmp366 to i32               ; <i32> [#uses=1]
392         %tmp369 = ptrtoint i8* %bptr307.4.0 to i32              ; <i32> [#uses=1]
393         %tmp370 = add i32 %tmp369, 1            ; <i32> [#uses=1]
394         %tmp370.upgrd.35 = inttoptr i32 %tmp370 to i8*          ; <i8*> [#uses=3]
395         %tmp372 = load i8* %tmp370.upgrd.35             ; <i8> [#uses=1]
396         %tmp372.upgrd.36 = zext i8 %tmp372 to i32               ; <i32> [#uses=1]
397         %shift.upgrd.37 = zext i8 %tmp319 to i32                ; <i32> [#uses=1]
398         %tmp374463 = lshr i32 %tmp372.upgrd.36, %shift.upgrd.37         ; <i32> [#uses=1]
399         %shift.upgrd.38 = zext i8 %tmp324 to i32                ; <i32> [#uses=1]
400         %tmp368 = shl i32 %tmp366.upgrd.34, %shift.upgrd.38             ; <i32> [#uses=1]
401         %tmp377 = add i32 %tmp374463, %tmp368           ; <i32> [#uses=1]
402         %tmp379 = xor i32 %tmp377, %iftmp.35.0          ; <i32> [#uses=2]
403         %tmp382 = or i32 %tmp379, %iftmp.36.0           ; <i32> [#uses=1]
404         %tmp382.upgrd.39 = trunc i32 %tmp382 to i8              ; <i8> [#uses=1]
405         %tmp384 = load i8* %optr309.3.0         ; <i8> [#uses=1]
406         %tmp385 = and i8 %tmp382.upgrd.39, %tmp384              ; <i8> [#uses=1]
407         %tmp388 = and i32 %tmp379, %iftmp.37.0          ; <i32> [#uses=1]
408         %tmp388.upgrd.40 = trunc i32 %tmp388 to i8              ; <i8> [#uses=1]
409         %tmp389 = or i8 %tmp385, %tmp388.upgrd.40               ; <i8> [#uses=1]
410         store i8 %tmp389, i8* %optr309.3.0
411         %tmp392 = add i32 %count308.3.0, -8             ; <i32> [#uses=2]
412         %optr309.3.in = add i32 %optr309.3.in.0, 1              ; <i32> [#uses=1]
413         %optr309.3 = inttoptr i32 %optr309.3.in to i8*          ; <i8*> [#uses=2]
414         %tmp397 = icmp sgt i32 %tmp392, 7               ; <i1> [#uses=1]
415         %indvar.next67 = add i32 %indvar66, 1           ; <i32> [#uses=1]
416         br i1 %tmp397, label %cond_true398, label %bb401.loopexit
417
418 bb401.loopexit:         ; preds = %cond_true398
419         br label %bb401
420
421 bb401:          ; preds = %bb401.loopexit, %cond_next340
422         %count308.3.1 = phi i32 [ %tmp361, %cond_next340 ], [ %tmp392, %bb401.loopexit ]                ; <i32> [#uses=2]
423         %bptr307.4.1 = phi i8* [ %bptr307.3, %cond_next340 ], [ %tmp370.upgrd.35, %bb401.loopexit ]             ; <i8*> [#uses=2]
424         %optr309.3.1 = phi i8* [ %optr309.353, %cond_next340 ], [ %optr309.3, %bb401.loopexit ]         ; <i8*> [#uses=2]
425         %tmp403 = icmp sgt i32 %count308.3.1, 0         ; <i1> [#uses=1]
426         br i1 %tmp403, label %cond_true404, label %cond_next442
427
428 cond_true404:           ; preds = %bb401
429         %tmp406 = load i8* %bptr307.4.1         ; <i8> [#uses=1]
430         %tmp406.upgrd.41 = zext i8 %tmp406 to i32               ; <i32> [#uses=1]
431         %shift.upgrd.42 = zext i8 %tmp324 to i32                ; <i32> [#uses=1]
432         %tmp408 = shl i32 %tmp406.upgrd.41, %shift.upgrd.42             ; <i32> [#uses=2]
433         %tmp413 = icmp sgt i32 %count308.3.1, %tmp303           ; <i1> [#uses=1]
434         br i1 %tmp413, label %cond_true414, label %cond_next422
435
436 cond_true414:           ; preds = %cond_true404
437         %tmp409 = ptrtoint i8* %bptr307.4.1 to i32              ; <i32> [#uses=1]
438         %tmp410 = add i32 %tmp409, 1            ; <i32> [#uses=1]
439         %tmp410.upgrd.43 = inttoptr i32 %tmp410 to i8*          ; <i8*> [#uses=1]
440         %tmp416 = load i8* %tmp410.upgrd.43             ; <i8> [#uses=1]
441         %tmp416.upgrd.44 = zext i8 %tmp416 to i32               ; <i32> [#uses=1]
442         %shift.upgrd.45 = zext i8 %tmp319 to i32                ; <i32> [#uses=1]
443         %tmp418 = lshr i32 %tmp416.upgrd.44, %shift.upgrd.45            ; <i32> [#uses=2]
444         %tmp420 = add i32 %tmp418, %tmp408              ; <i32> [#uses=1]
445         br label %cond_next422
446
447 cond_next422:           ; preds = %cond_true414, %cond_true404
448         %bits.6 = phi i32 [ %tmp420, %cond_true414 ], [ %tmp408, %cond_true404 ]                ; <i32> [#uses=1]
449         %tmp425 = xor i32 %bits.6, %iftmp.35.0          ; <i32> [#uses=1]
450         %tmp427 = trunc i32 %tmp425 to i8               ; <i8> [#uses=2]
451         %tmp430 = or i8 %tmp428, %tmp427                ; <i8> [#uses=1]
452         %tmp432 = load i8* %optr309.3.1         ; <i8> [#uses=1]
453         %tmp433 = and i8 %tmp430, %tmp432               ; <i8> [#uses=1]
454         %tmp438 = and i8 %tmp436.upgrd.47, %tmp427              ; <i8> [#uses=1]
455         %tmp439 = or i8 %tmp433, %tmp438                ; <i8> [#uses=1]
456         store i8 %tmp439, i8* %optr309.3.1
457         br label %cond_next442
458
459 cond_next442:           ; preds = %cond_next422, %bb401
460         %tmp443 = ptrtoint i8** %dest_line.3.0 to i32           ; <i32> [#uses=1]
461         %tmp444 = add i32 %tmp443, 4            ; <i32> [#uses=1]
462         %tmp444.upgrd.46 = inttoptr i32 %tmp444 to i8**         ; <i8**> [#uses=2]
463         %tmp446 = load i8** %tmp444.upgrd.46            ; <i8*> [#uses=1]
464         %tmp448 = getelementptr i8* %tmp446, i32 %tmp93         ; <i8*> [#uses=1]
465         %tmp454 = add i32 %tmp454.0, -1         ; <i32> [#uses=1]
466         %tmp456 = icmp slt i32 %tmp454, 0               ; <i1> [#uses=1]
467         %indvar.next75 = add i32 %indvar74, 1           ; <i32> [#uses=1]
468         br i1 %tmp456, label %return.loopexit56, label %cond_true457
469
470 cond_true457.preheader:         ; preds = %cond_false299
471         %tmp315 = icmp slt i32 %tmp107, %tmp110         ; <i1> [#uses=1]
472         %tmp319 = trunc i32 %tmp303 to i8               ; <i8> [#uses=4]
473         %tmp324 = trunc i32 %tmp305 to i8               ; <i8> [#uses=3]
474         %tmp330 = icmp slt i32 %tmp107, %w              ; <i1> [#uses=1]
475         %tmp344 = trunc i32 %mask.1.1 to i8             ; <i8> [#uses=1]
476         %tmp344not = xor i8 %tmp344, -1         ; <i8> [#uses=1]
477         %tmp347 = trunc i32 %iftmp.36.0 to i8           ; <i8> [#uses=2]
478         %tmp346 = or i8 %tmp347, %tmp344not             ; <i8> [#uses=1]
479         %tmp354 = and i32 %iftmp.37.0, %mask.1.1                ; <i32> [#uses=1]
480         %tmp361 = sub i32 %w, %tmp110           ; <i32> [#uses=2]
481         %tmp39755 = icmp sgt i32 %tmp361, 7             ; <i1> [#uses=1]
482         %tmp426 = trunc i32 %rmask.0.1 to i8            ; <i8> [#uses=1]
483         %tmp426not = xor i8 %tmp426, -1         ; <i8> [#uses=1]
484         %tmp428 = or i8 %tmp347, %tmp426not             ; <i8> [#uses=1]
485         %tmp436 = and i32 %iftmp.37.0, %rmask.0.1               ; <i32> [#uses=1]
486         %tmp436.upgrd.47 = trunc i32 %tmp436 to i8              ; <i8> [#uses=1]
487         br label %cond_true457
488
489 cond_true457:           ; preds = %cond_true457.preheader, %cond_next442
490         %indvar74 = phi i32 [ 0, %cond_true457.preheader ], [ %indvar.next75, %cond_next442 ]           ; <i32> [#uses=3]
491         %dest.3.0 = phi i8* [ %tmp448, %cond_next442 ], [ %tmp100, %cond_true457.preheader ]            ; <i8*> [#uses=3]
492         %dest_line.3.0 = phi i8** [ %tmp444.upgrd.46, %cond_next442 ], [ %tmp96, %cond_true457.preheader ]              ; <i8**> [#uses=1]
493         %tmp.77 = sub i32 0, %indvar74          ; <i32> [#uses=2]
494         %tmp454.0 = add i32 %tmp.77, %tmp45438          ; <i32> [#uses=1]
495         %tmp.79 = mul i32 %indvar74, %raster            ; <i32> [#uses=2]
496         %tmp104.sum = add i32 %tmp102, %tmp.79          ; <i32> [#uses=1]
497         %line.3.0 = getelementptr i8* %base, i32 %tmp104.sum            ; <i8*> [#uses=3]
498         %tmp318.upgrd.48 = load i8* %line.3.0           ; <i8> [#uses=2]
499         br i1 %tmp315, label %cond_false321, label %cond_true316
500
501 return.loopexit:                ; preds = %cond_next280
502         br label %return.loopexit.split
503
504 return.loopexit.split:          ; preds = %return.loopexit, %return.loopexit.us
505         br label %return
506
507 return.loopexit56:              ; preds = %cond_next442
508         br label %return
509
510 return:         ; preds = %return.loopexit56, %return.loopexit.split, %cond_false299, %cond_true197, %cond_next78, %cond_next63, %bb58, %cond_next46
511         %retval.0 = phi i32 [ 0, %cond_next46 ], [ -1, %bb58 ], [ -1, %cond_next63 ], [ -1, %cond_next78 ], [ 0, %cond_true197 ], [ 0, %cond_false299 ], [ 0, %return.loopexit.split ], [ 0, %return.loopexit56 ]               ; <i32> [#uses=1]
512         ret i32 %retval.0
513 }
514
515 declare i32 @mem_no_fault_proc(%struct.gx_device_memory*, i32, i32, i32, i32, i32)
516
517 declare i32 @mem_mono_fill_rectangle(%struct.gx_device*, i32, i32, i32, i32, i32)
518
519 declare i32 @mem_copy_mono_recover(%struct.gx_device*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32)