diff options
author | Richard Guenther <rguenther@suse.de> | 2010-04-13 09:48:26 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-04-13 09:48:26 +0000 |
commit | 777e1f09ffc68eb0c122c74275fd69aef2dea61d (patch) | |
tree | 1b7bb981ab3207d6bac81f6a8d4c80f528a0e0ed /gcc/tree-vect-loop.c | |
parent | 1a71080889e16d01cccd6af982386633dcec9ec9 (diff) | |
download | gcc-777e1f09ffc68eb0c122c74275fd69aef2dea61d.zip gcc-777e1f09ffc68eb0c122c74275fd69aef2dea61d.tar.gz gcc-777e1f09ffc68eb0c122c74275fd69aef2dea61d.tar.bz2 |
tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Only add RW dependence for dependence distance zero.
2010-04-13 Richard Guenther <rguenther@suse.de>
* tree-vect-data-refs.c (vect_analyze_data_ref_dependence):
Only add RW dependence for dependence distance zero.
Adjust maximal vectorization factor according to dependences.
Move alignment handling ...
(vect_find_same_alignment_drs): ... here. New function.
(vect_analyze_data_ref_dependences): Adjust.
(vect_analyze_data_refs_alignment): Call vect_find_same_alignment_drs.
(vect_analyze_data_refs): Adjust minimal vectorization factor
according to data references.
* tree-vect-loop.c (vect_analyze_loop): Analyze data-ref
dependences before determining the vectorization factor.
Analyze alignment after determining the vectorization factor.
* tree-vect-slp.c ((vect_slp_analyze_bb): Analyze data-ref
dependences before alignment.
* tree-vectorizer.h (vect_analyze_data_ref_dependences):
Adjust prototype.
(vect_analyze_data_refs): Likewise.
(MAX_VECTORIZATION_FACTOR): New define.
* gcc.dg/vect/no-vfa-vect-depend-1.c: Adjust.
From-SVN: r158259
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index c654795..809f3e1 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1354,6 +1354,8 @@ vect_analyze_loop (struct loop *loop) { bool ok; loop_vec_info loop_vinfo; + int max_vf = MAX_VECTORIZATION_FACTOR; + int min_vf = 2; if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "===== analyze_loop_nest ====="); @@ -1378,12 +1380,13 @@ vect_analyze_loop (struct loop *loop) } /* Find all data references in the loop (which correspond to vdefs/vuses) - and analyze their evolution in the loop. + and analyze their evolution in the loop. Also adjust the minimal + vectorization factor according to the loads and stores. FORNOW: Handle only simple, array references, which alignment can be forced, and aligned pointer-references. */ - ok = vect_analyze_data_refs (loop_vinfo, NULL); + ok = vect_analyze_data_refs (loop_vinfo, NULL, &min_vf); if (!ok) { if (vect_print_dump_info (REPORT_DETAILS)) @@ -1410,14 +1413,17 @@ vect_analyze_loop (struct loop *loop) return NULL; } - /* Analyze the alignment of the data-refs in the loop. - Fail if a data reference is found that cannot be vectorized. */ + /* Analyze data dependences between the data-refs in the loop + and adjust the maximum vectorization factor according to + the dependences. + FORNOW: fail at the first data dependence that we encounter. */ - ok = vect_analyze_data_refs_alignment (loop_vinfo, NULL); - if (!ok) + ok = vect_analyze_data_ref_dependences (loop_vinfo, NULL, &max_vf); + if (!ok + || max_vf < min_vf) { if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bad data alignment."); + fprintf (vect_dump, "bad data dependence."); destroy_loop_vec_info (loop_vinfo, true); return NULL; } @@ -1430,15 +1436,22 @@ vect_analyze_loop (struct loop *loop) destroy_loop_vec_info (loop_vinfo, true); return NULL; } + if (max_vf < LOOP_VINFO_VECT_FACTOR (loop_vinfo)) + { + if (vect_print_dump_info (REPORT_DETAILS)) + fprintf (vect_dump, "bad data dependence."); + destroy_loop_vec_info (loop_vinfo, true); + return NULL; + } - /* Analyze data dependences between the data-refs in the loop. - FORNOW: fail at the first data dependence that we encounter. */ + /* Analyze the alignment of the data-refs in the loop. + Fail if a data reference is found that cannot be vectorized. */ - ok = vect_analyze_data_ref_dependences (loop_vinfo, NULL); + ok = vect_analyze_data_refs_alignment (loop_vinfo, NULL); if (!ok) { if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "bad data dependence."); + fprintf (vect_dump, "bad data alignment."); destroy_loop_vec_info (loop_vinfo, true); return NULL; } |