diff options
Diffstat (limited to 'meta-oe/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106844.patch')
-rw-r--r-- | meta-oe/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106844.patch | 495 |
1 files changed, 495 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106844.patch b/meta-oe/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106844.patch new file mode 100644 index 000000000..e501959c7 --- /dev/null +++ b/meta-oe/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106844.patch | |||
@@ -0,0 +1,495 @@ | |||
1 | 2011-11-27 Ira Rosen <ira.rosen@linaro.org> | ||
2 | |||
3 | gcc/ | ||
4 | * tree-vectorizer.h (vect_pattern_recog): Add new argument. | ||
5 | * tree-vect-loop.c (vect_analyze_loop_2): Update call to | ||
6 | vect_pattern_recog. | ||
7 | * tree-vect-patterns.c (widened_name_p): Pass basic block | ||
8 | info to vect_is_simple_use. | ||
9 | (vect_recog_dot_prod_pattern): Fail for basic blocks. | ||
10 | (vect_recog_widen_sum_pattern): Likewise. | ||
11 | (vect_handle_widen_op_by_const): Support basic blocks. | ||
12 | (vect_operation_fits_smaller_type, | ||
13 | vect_recog_over_widening_pattern): Likewise. | ||
14 | (vect_recog_mixed_size_cond_pattern): Support basic blocks. | ||
15 | Add printing. | ||
16 | (vect_mark_pattern_stmts): Update calls to new_stmt_vec_info. | ||
17 | (vect_pattern_recog_1): Check for reduction only in loops. | ||
18 | (vect_pattern_recog): Add new argument. Support basic blocks. | ||
19 | * tree-vect-stmts.c (vectorizable_conversion): Pass basic block | ||
20 | info to vect_is_simple_use_1. | ||
21 | * tree-vect-slp.c (vect_get_and_check_slp_defs): Support basic | ||
22 | blocks. | ||
23 | (vect_slp_analyze_bb_1): Call vect_pattern_recog. | ||
24 | |||
25 | gcc/testsuite/ | ||
26 | * gcc.dg/vect/bb-slp-pattern-1.c: New test. | ||
27 | * gcc.dg/vect/bb-slp-pattern-2.c: New test. | ||
28 | |||
29 | === added file 'gcc/testsuite/gcc.dg/vect/bb-slp-pattern-1.c' | ||
30 | --- old/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-1.c 1970-01-01 00:00:00 +0000 | ||
31 | +++ new/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-1.c 2011-11-23 06:37:10 +0000 | ||
32 | @@ -0,0 +1,55 @@ | ||
33 | +/* { dg-require-effective-target vect_int } */ | ||
34 | + | ||
35 | +#include <stdarg.h> | ||
36 | +#include "tree-vect.h" | ||
37 | + | ||
38 | +#define N 8 | ||
39 | + | ||
40 | +unsigned short X[N]; | ||
41 | +unsigned short Y[N]; | ||
42 | +unsigned int result[N]; | ||
43 | + | ||
44 | +/* unsigned short->unsigned int widening-mult. */ | ||
45 | +__attribute__ ((noinline, noclone)) void | ||
46 | +foo (void) | ||
47 | +{ | ||
48 | + result[0] = (unsigned int)(X[0] * Y[0]); | ||
49 | + result[1] = (unsigned int)(X[1] * Y[1]); | ||
50 | + result[2] = (unsigned int)(X[2] * Y[2]); | ||
51 | + result[3] = (unsigned int)(X[3] * Y[3]); | ||
52 | + result[4] = (unsigned int)(X[4] * Y[4]); | ||
53 | + result[5] = (unsigned int)(X[5] * Y[5]); | ||
54 | + result[6] = (unsigned int)(X[6] * Y[6]); | ||
55 | + result[7] = (unsigned int)(X[7] * Y[7]); | ||
56 | +} | ||
57 | + | ||
58 | +int main (void) | ||
59 | +{ | ||
60 | + int i, tmp; | ||
61 | + | ||
62 | + check_vect (); | ||
63 | + | ||
64 | + for (i = 0; i < N; i++) | ||
65 | + { | ||
66 | + X[i] = i; | ||
67 | + Y[i] = 64-i; | ||
68 | + } | ||
69 | + | ||
70 | + foo (); | ||
71 | + | ||
72 | + for (i = 0; i < N; i++) | ||
73 | + { | ||
74 | + __asm__ volatile (""); | ||
75 | + tmp = X[i] * Y[i]; | ||
76 | + if (result[i] != tmp) | ||
77 | + abort (); | ||
78 | + } | ||
79 | + | ||
80 | + return 0; | ||
81 | +} | ||
82 | + | ||
83 | +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "slp" { target { vect_widen_mult_hi_to_si || vect_unpack } } } } */ | ||
84 | +/* { dg-final { scan-tree-dump-times "vect_recog_widen_mult_pattern: detected" 8 "slp" { target vect_widen_mult_hi_to_si_pattern } } } */ | ||
85 | +/* { dg-final { scan-tree-dump-times "pattern recognized" 8 "slp" { target vect_widen_mult_hi_to_si_pattern } } } */ | ||
86 | +/* { dg-final { cleanup-tree-dump "slp" } } */ | ||
87 | + | ||
88 | |||
89 | === added file 'gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c' | ||
90 | --- old/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c 1970-01-01 00:00:00 +0000 | ||
91 | +++ new/gcc/testsuite/gcc.dg/vect/bb-slp-pattern-2.c 2011-11-23 06:37:10 +0000 | ||
92 | @@ -0,0 +1,53 @@ | ||
93 | +/* { dg-require-effective-target vect_condition } */ | ||
94 | + | ||
95 | +#include "tree-vect.h" | ||
96 | + | ||
97 | +#define N 128 | ||
98 | + | ||
99 | +__attribute__((noinline, noclone)) void | ||
100 | +foo (short * __restrict__ a, int * __restrict__ b, int stride) | ||
101 | +{ | ||
102 | + int i; | ||
103 | + | ||
104 | + for (i = 0; i < N/stride; i++, a += stride, b += stride) | ||
105 | + { | ||
106 | + a[0] = b[0] ? 1 : 7; | ||
107 | + a[1] = b[1] ? 2 : 0; | ||
108 | + a[2] = b[2] ? 3 : 0; | ||
109 | + a[3] = b[3] ? 4 : 0; | ||
110 | + a[4] = b[4] ? 5 : 0; | ||
111 | + a[5] = b[5] ? 6 : 0; | ||
112 | + a[6] = b[6] ? 7 : 0; | ||
113 | + a[7] = b[7] ? 8 : 0; | ||
114 | + } | ||
115 | +} | ||
116 | + | ||
117 | +short a[N]; | ||
118 | +int b[N]; | ||
119 | +int main () | ||
120 | +{ | ||
121 | + int i; | ||
122 | + | ||
123 | + check_vect (); | ||
124 | + | ||
125 | + for (i = 0; i < N; i++) | ||
126 | + { | ||
127 | + a[i] = i; | ||
128 | + b[i] = -i; | ||
129 | + } | ||
130 | + | ||
131 | + foo (a, b, 8); | ||
132 | + | ||
133 | + for (i = 1; i < N; i++) | ||
134 | + if (a[i] != i%8 + 1) | ||
135 | + abort (); | ||
136 | + | ||
137 | + if (a[0] != 7) | ||
138 | + abort (); | ||
139 | + | ||
140 | + return 0; | ||
141 | +} | ||
142 | + | ||
143 | +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target { vect_element_align && vect_pack_trunc } } } } */ | ||
144 | +/* { dg-final { cleanup-tree-dump "slp" } } */ | ||
145 | + | ||
146 | |||
147 | === modified file 'gcc/tree-vect-loop.c' | ||
148 | --- old/gcc/tree-vect-loop.c 2011-11-20 08:24:08 +0000 | ||
149 | +++ new/gcc/tree-vect-loop.c 2011-11-23 06:47:35 +0000 | ||
150 | @@ -1458,7 +1458,7 @@ | ||
151 | |||
152 | vect_analyze_scalar_cycles (loop_vinfo); | ||
153 | |||
154 | - vect_pattern_recog (loop_vinfo); | ||
155 | + vect_pattern_recog (loop_vinfo, NULL); | ||
156 | |||
157 | /* Data-flow analysis to detect stmts that do not need to be vectorized. */ | ||
158 | |||
159 | |||
160 | === modified file 'gcc/tree-vect-patterns.c' | ||
161 | --- old/gcc/tree-vect-patterns.c 2011-11-20 09:11:09 +0000 | ||
162 | +++ new/gcc/tree-vect-patterns.c 2011-11-23 07:49:33 +0000 | ||
163 | @@ -83,11 +83,13 @@ | ||
164 | tree oprnd0; | ||
165 | enum vect_def_type dt; | ||
166 | tree def; | ||
167 | + bb_vec_info bb_vinfo; | ||
168 | |||
169 | stmt_vinfo = vinfo_for_stmt (use_stmt); | ||
170 | loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo); | ||
171 | + bb_vinfo = STMT_VINFO_BB_VINFO (stmt_vinfo); | ||
172 | |||
173 | - if (!vect_is_simple_use (name, loop_vinfo, NULL, def_stmt, &def, &dt)) | ||
174 | + if (!vect_is_simple_use (name, loop_vinfo, bb_vinfo, def_stmt, &def, &dt)) | ||
175 | return false; | ||
176 | |||
177 | if (dt != vect_internal_def | ||
178 | @@ -111,7 +113,7 @@ | ||
179 | || (TYPE_PRECISION (type) < (TYPE_PRECISION (*half_type) * 2))) | ||
180 | return false; | ||
181 | |||
182 | - if (!vect_is_simple_use (oprnd0, loop_vinfo, NULL, &dummy_gimple, &dummy, | ||
183 | + if (!vect_is_simple_use (oprnd0, loop_vinfo, bb_vinfo, &dummy_gimple, &dummy, | ||
184 | &dt)) | ||
185 | return false; | ||
186 | |||
187 | @@ -188,9 +190,14 @@ | ||
188 | gimple pattern_stmt; | ||
189 | tree prod_type; | ||
190 | loop_vec_info loop_info = STMT_VINFO_LOOP_VINFO (stmt_vinfo); | ||
191 | - struct loop *loop = LOOP_VINFO_LOOP (loop_info); | ||
192 | + struct loop *loop; | ||
193 | tree var, rhs; | ||
194 | |||
195 | + if (!loop_info) | ||
196 | + return NULL; | ||
197 | + | ||
198 | + loop = LOOP_VINFO_LOOP (loop_info); | ||
199 | + | ||
200 | if (!is_gimple_assign (last_stmt)) | ||
201 | return NULL; | ||
202 | |||
203 | @@ -358,8 +365,16 @@ | ||
204 | { | ||
205 | tree new_type, new_oprnd, tmp; | ||
206 | gimple new_stmt; | ||
207 | - loop_vec_info loop_info = STMT_VINFO_LOOP_VINFO (vinfo_for_stmt (stmt)); | ||
208 | - struct loop *loop = LOOP_VINFO_LOOP (loop_info); | ||
209 | + loop_vec_info loop_vinfo; | ||
210 | + struct loop *loop = NULL; | ||
211 | + bb_vec_info bb_vinfo; | ||
212 | + stmt_vec_info stmt_vinfo; | ||
213 | + | ||
214 | + stmt_vinfo = vinfo_for_stmt (stmt); | ||
215 | + loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo); | ||
216 | + bb_vinfo = STMT_VINFO_BB_VINFO (stmt_vinfo); | ||
217 | + if (loop_vinfo) | ||
218 | + loop = LOOP_VINFO_LOOP (loop_vinfo); | ||
219 | |||
220 | if (code != MULT_EXPR && code != LSHIFT_EXPR) | ||
221 | return false; | ||
222 | @@ -377,7 +392,9 @@ | ||
223 | |||
224 | if (TYPE_PRECISION (type) < (TYPE_PRECISION (*half_type) * 4) | ||
225 | || !gimple_bb (def_stmt) | ||
226 | - || !flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) | ||
227 | + || (loop && !flow_bb_inside_loop_p (loop, gimple_bb (def_stmt))) | ||
228 | + || (!loop && gimple_bb (def_stmt) != BB_VINFO_BB (bb_vinfo) | ||
229 | + && gimple_code (def_stmt) != GIMPLE_PHI) | ||
230 | || !vinfo_for_stmt (def_stmt)) | ||
231 | return false; | ||
232 | |||
233 | @@ -774,9 +791,14 @@ | ||
234 | tree type, half_type; | ||
235 | gimple pattern_stmt; | ||
236 | loop_vec_info loop_info = STMT_VINFO_LOOP_VINFO (stmt_vinfo); | ||
237 | - struct loop *loop = LOOP_VINFO_LOOP (loop_info); | ||
238 | + struct loop *loop; | ||
239 | tree var; | ||
240 | |||
241 | + if (!loop_info) | ||
242 | + return NULL; | ||
243 | + | ||
244 | + loop = LOOP_VINFO_LOOP (loop_info); | ||
245 | + | ||
246 | if (!is_gimple_assign (last_stmt)) | ||
247 | return NULL; | ||
248 | |||
249 | @@ -877,7 +899,11 @@ | ||
250 | gimple def_stmt, new_stmt; | ||
251 | bool first = false; | ||
252 | loop_vec_info loop_info = STMT_VINFO_LOOP_VINFO (vinfo_for_stmt (stmt)); | ||
253 | - struct loop *loop = LOOP_VINFO_LOOP (loop_info); | ||
254 | + bb_vec_info bb_info = STMT_VINFO_BB_VINFO (vinfo_for_stmt (stmt)); | ||
255 | + struct loop *loop = NULL; | ||
256 | + | ||
257 | + if (loop_info) | ||
258 | + loop = LOOP_VINFO_LOOP (loop_info); | ||
259 | |||
260 | *new_def_stmt = NULL; | ||
261 | |||
262 | @@ -909,7 +935,9 @@ | ||
263 | first = true; | ||
264 | if (!widened_name_p (oprnd, stmt, &half_type, &def_stmt, false) | ||
265 | || !gimple_bb (def_stmt) | ||
266 | - || !flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) | ||
267 | + || (loop && !flow_bb_inside_loop_p (loop, gimple_bb (def_stmt))) | ||
268 | + || (!loop && gimple_bb (def_stmt) != BB_VINFO_BB (bb_info) | ||
269 | + && gimple_code (def_stmt) != GIMPLE_PHI) | ||
270 | || !vinfo_for_stmt (def_stmt)) | ||
271 | return false; | ||
272 | } | ||
273 | @@ -1087,7 +1115,16 @@ | ||
274 | int nuses = 0; | ||
275 | tree var = NULL_TREE, new_type = NULL_TREE, tmp, new_oprnd; | ||
276 | bool first; | ||
277 | - struct loop *loop = (gimple_bb (stmt))->loop_father; | ||
278 | + loop_vec_info loop_vinfo; | ||
279 | + struct loop *loop = NULL; | ||
280 | + bb_vec_info bb_vinfo; | ||
281 | + stmt_vec_info stmt_vinfo; | ||
282 | + | ||
283 | + stmt_vinfo = vinfo_for_stmt (stmt); | ||
284 | + loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo); | ||
285 | + bb_vinfo = STMT_VINFO_BB_VINFO (stmt_vinfo); | ||
286 | + if (loop_vinfo) | ||
287 | + loop = LOOP_VINFO_LOOP (loop_vinfo); | ||
288 | |||
289 | first = true; | ||
290 | while (1) | ||
291 | @@ -1120,7 +1157,8 @@ | ||
292 | |||
293 | if (nuses != 1 || !is_gimple_assign (use_stmt) | ||
294 | || !gimple_bb (use_stmt) | ||
295 | - || !flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) | ||
296 | + || (loop && !flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) | ||
297 | + || (!loop && gimple_bb (use_stmt) != BB_VINFO_BB (bb_vinfo))) | ||
298 | return NULL; | ||
299 | |||
300 | /* Create pattern statement for STMT. */ | ||
301 | @@ -1485,6 +1523,7 @@ | ||
302 | enum machine_mode cmpmode; | ||
303 | gimple pattern_stmt, def_stmt; | ||
304 | loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo); | ||
305 | + bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_vinfo); | ||
306 | |||
307 | if (!is_gimple_assign (last_stmt) | ||
308 | || gimple_assign_rhs_code (last_stmt) != COND_EXPR | ||
309 | @@ -1538,7 +1577,8 @@ | ||
310 | tmp = build3 (COND_EXPR, comp_type, unshare_expr (cond_expr), | ||
311 | fold_convert (comp_type, then_clause), | ||
312 | fold_convert (comp_type, else_clause)); | ||
313 | - def_stmt = gimple_build_assign (vect_recog_temp_ssa_var (comp_type, NULL), tmp); | ||
314 | + def_stmt = gimple_build_assign (vect_recog_temp_ssa_var (comp_type, NULL), | ||
315 | + tmp); | ||
316 | |||
317 | pattern_stmt | ||
318 | = gimple_build_assign_with_ops (NOP_EXPR, | ||
319 | @@ -1546,12 +1586,15 @@ | ||
320 | gimple_assign_lhs (def_stmt), NULL_TREE); | ||
321 | |||
322 | STMT_VINFO_PATTERN_DEF_STMT (stmt_vinfo) = def_stmt; | ||
323 | - def_stmt_info = new_stmt_vec_info (def_stmt, loop_vinfo, NULL); | ||
324 | + def_stmt_info = new_stmt_vec_info (def_stmt, loop_vinfo, bb_vinfo); | ||
325 | set_vinfo_for_stmt (def_stmt, def_stmt_info); | ||
326 | STMT_VINFO_VECTYPE (def_stmt_info) = comp_vectype; | ||
327 | *type_in = vectype; | ||
328 | *type_out = vectype; | ||
329 | |||
330 | + if (vect_print_dump_info (REPORT_DETAILS)) | ||
331 | + fprintf (vect_dump, "vect_recog_mixed_size_cond_pattern: detected: "); | ||
332 | + | ||
333 | return pattern_stmt; | ||
334 | } | ||
335 | |||
336 | @@ -1565,10 +1608,11 @@ | ||
337 | stmt_vec_info pattern_stmt_info, def_stmt_info; | ||
338 | stmt_vec_info orig_stmt_info = vinfo_for_stmt (orig_stmt); | ||
339 | loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (orig_stmt_info); | ||
340 | + bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (orig_stmt_info); | ||
341 | gimple def_stmt; | ||
342 | |||
343 | set_vinfo_for_stmt (pattern_stmt, | ||
344 | - new_stmt_vec_info (pattern_stmt, loop_vinfo, NULL)); | ||
345 | + new_stmt_vec_info (pattern_stmt, loop_vinfo, bb_vinfo)); | ||
346 | gimple_set_bb (pattern_stmt, gimple_bb (orig_stmt)); | ||
347 | pattern_stmt_info = vinfo_for_stmt (pattern_stmt); | ||
348 | |||
349 | @@ -1586,7 +1630,7 @@ | ||
350 | def_stmt_info = vinfo_for_stmt (def_stmt); | ||
351 | if (def_stmt_info == NULL) | ||
352 | { | ||
353 | - def_stmt_info = new_stmt_vec_info (def_stmt, loop_vinfo, NULL); | ||
354 | + def_stmt_info = new_stmt_vec_info (def_stmt, loop_vinfo, bb_vinfo); | ||
355 | set_vinfo_for_stmt (def_stmt, def_stmt_info); | ||
356 | } | ||
357 | gimple_set_bb (def_stmt, gimple_bb (orig_stmt)); | ||
358 | @@ -1697,9 +1741,10 @@ | ||
359 | |||
360 | /* Patterns cannot be vectorized using SLP, because they change the order of | ||
361 | computation. */ | ||
362 | - FOR_EACH_VEC_ELT (gimple, LOOP_VINFO_REDUCTIONS (loop_vinfo), i, next) | ||
363 | - if (next == stmt) | ||
364 | - VEC_ordered_remove (gimple, LOOP_VINFO_REDUCTIONS (loop_vinfo), i); | ||
365 | + if (loop_vinfo) | ||
366 | + FOR_EACH_VEC_ELT (gimple, LOOP_VINFO_REDUCTIONS (loop_vinfo), i, next) | ||
367 | + if (next == stmt) | ||
368 | + VEC_ordered_remove (gimple, LOOP_VINFO_REDUCTIONS (loop_vinfo), i); | ||
369 | |||
370 | /* It is possible that additional pattern stmts are created and inserted in | ||
371 | STMTS_TO_REPLACE. We create a stmt_info for each of them, and mark the | ||
372 | @@ -1799,26 +1844,46 @@ | ||
373 | be recorded in S3. */ | ||
374 | |||
375 | void | ||
376 | -vect_pattern_recog (loop_vec_info loop_vinfo) | ||
377 | +vect_pattern_recog (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) | ||
378 | { | ||
379 | - struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); | ||
380 | - basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo); | ||
381 | - unsigned int nbbs = loop->num_nodes; | ||
382 | + struct loop *loop; | ||
383 | + basic_block *bbs, bb; | ||
384 | + unsigned int nbbs; | ||
385 | gimple_stmt_iterator si; | ||
386 | unsigned int i, j; | ||
387 | gimple (* vect_recog_func_ptr) (VEC (gimple, heap) **, tree *, tree *); | ||
388 | VEC (gimple, heap) *stmts_to_replace = VEC_alloc (gimple, heap, 1); | ||
389 | + gimple stmt; | ||
390 | |||
391 | if (vect_print_dump_info (REPORT_DETAILS)) | ||
392 | fprintf (vect_dump, "=== vect_pattern_recog ==="); | ||
393 | |||
394 | - /* Scan through the loop stmts, applying the pattern recognition | ||
395 | + if (loop_vinfo) | ||
396 | + { | ||
397 | + loop = LOOP_VINFO_LOOP (loop_vinfo); | ||
398 | + bbs = LOOP_VINFO_BBS (loop_vinfo); | ||
399 | + nbbs = loop->num_nodes; | ||
400 | + } | ||
401 | + else | ||
402 | + { | ||
403 | + bb = BB_VINFO_BB (bb_vinfo); | ||
404 | + nbbs = 1; | ||
405 | + bbs = XNEW (basic_block); | ||
406 | + bbs[0] = bb; | ||
407 | + } | ||
408 | + | ||
409 | + /* Scan through the stmts, applying the pattern recognition | ||
410 | functions starting at each stmt visited: */ | ||
411 | for (i = 0; i < nbbs; i++) | ||
412 | { | ||
413 | basic_block bb = bbs[i]; | ||
414 | for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) | ||
415 | { | ||
416 | + if (bb_vinfo && (stmt = gsi_stmt (si)) | ||
417 | + && vinfo_for_stmt (stmt) | ||
418 | + && !STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (stmt))) | ||
419 | + continue; | ||
420 | + | ||
421 | /* Scan over all generic vect_recog_xxx_pattern functions. */ | ||
422 | for (j = 0; j < NUM_PATTERNS; j++) | ||
423 | { | ||
424 | @@ -1830,4 +1895,6 @@ | ||
425 | } | ||
426 | |||
427 | VEC_free (gimple, heap, stmts_to_replace); | ||
428 | + if (bb_vinfo) | ||
429 | + free (bbs); | ||
430 | } | ||
431 | |||
432 | === modified file 'gcc/tree-vect-slp.c' | ||
433 | --- old/gcc/tree-vect-slp.c 2011-11-21 06:58:40 +0000 | ||
434 | +++ new/gcc/tree-vect-slp.c 2011-11-23 06:47:35 +0000 | ||
435 | @@ -255,12 +255,14 @@ | ||
436 | /* Check if DEF_STMT is a part of a pattern in LOOP and get the def stmt | ||
437 | from the pattern. Check that all the stmts of the node are in the | ||
438 | pattern. */ | ||
439 | - if (loop && def_stmt && gimple_bb (def_stmt) | ||
440 | - && flow_bb_inside_loop_p (loop, gimple_bb (def_stmt)) | ||
441 | + if (def_stmt && gimple_bb (def_stmt) | ||
442 | + && ((loop && flow_bb_inside_loop_p (loop, gimple_bb (def_stmt))) | ||
443 | + || (!loop && gimple_bb (def_stmt) == BB_VINFO_BB (bb_vinfo) | ||
444 | + && gimple_code (def_stmt) != GIMPLE_PHI)) | ||
445 | && vinfo_for_stmt (def_stmt) | ||
446 | && STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (def_stmt)) | ||
447 | - && !STMT_VINFO_RELEVANT (vinfo_for_stmt (def_stmt)) | ||
448 | - && !STMT_VINFO_LIVE_P (vinfo_for_stmt (def_stmt))) | ||
449 | + && !STMT_VINFO_RELEVANT (vinfo_for_stmt (def_stmt)) | ||
450 | + && !STMT_VINFO_LIVE_P (vinfo_for_stmt (def_stmt))) | ||
451 | { | ||
452 | pattern = true; | ||
453 | if (!first && !oprnd_info->first_pattern) | ||
454 | @@ -1972,6 +1974,8 @@ | ||
455 | return NULL; | ||
456 | } | ||
457 | |||
458 | + vect_pattern_recog (NULL, bb_vinfo); | ||
459 | + | ||
460 | if (!vect_analyze_data_ref_dependences (NULL, bb_vinfo, &max_vf, | ||
461 | &data_dependence_in_bb) | ||
462 | || min_vf > max_vf | ||
463 | |||
464 | === modified file 'gcc/tree-vect-stmts.c' | ||
465 | --- old/gcc/tree-vect-stmts.c 2011-11-22 17:10:17 +0000 | ||
466 | +++ new/gcc/tree-vect-stmts.c 2011-11-23 06:47:35 +0000 | ||
467 | @@ -3451,11 +3451,11 @@ | ||
468 | /* For WIDEN_MULT_EXPR, if OP0 is a constant, use the type of | ||
469 | OP1. */ | ||
470 | if (CONSTANT_CLASS_P (op0)) | ||
471 | - ok = vect_is_simple_use_1 (op1, loop_vinfo, NULL, | ||
472 | + ok = vect_is_simple_use_1 (op1, loop_vinfo, bb_vinfo, | ||
473 | &def_stmt, &def, &dt[1], &vectype_in); | ||
474 | else | ||
475 | - ok = vect_is_simple_use (op1, loop_vinfo, NULL, &def_stmt, &def, | ||
476 | - &dt[1]); | ||
477 | + ok = vect_is_simple_use (op1, loop_vinfo, bb_vinfo, &def_stmt, | ||
478 | + &def, &dt[1]); | ||
479 | |||
480 | if (!ok) | ||
481 | { | ||
482 | |||
483 | === modified file 'gcc/tree-vectorizer.h' | ||
484 | --- old/gcc/tree-vectorizer.h 2011-11-22 17:10:17 +0000 | ||
485 | +++ new/gcc/tree-vectorizer.h 2011-11-23 06:47:35 +0000 | ||
486 | @@ -918,7 +918,7 @@ | ||
487 | in the future. */ | ||
488 | typedef gimple (* vect_recog_func_ptr) (VEC (gimple, heap) **, tree *, tree *); | ||
489 | #define NUM_PATTERNS 7 | ||
490 | -void vect_pattern_recog (loop_vec_info); | ||
491 | +void vect_pattern_recog (loop_vec_info, bb_vec_info); | ||
492 | |||
493 | /* In tree-vectorizer.c. */ | ||
494 | unsigned vectorize_loops (void); | ||
495 | |||