aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorBin Cheng <bin.cheng@arm.com>2016-10-13 10:58:26 +0000
committerBin Cheng <amker@gcc.gnu.org>2016-10-13 10:58:26 +0000
commit328ba117bab9dfd05bfdde90d3673661d1654e09 (patch)
tree51ac8be786c9c0e5cfd50b5aa0cd1b0d601f2548 /gcc/tree-vect-loop.c
parent37cf9f4f1c3251d594468e52e41e18433130aba7 (diff)
downloadgcc-328ba117bab9dfd05bfdde90d3673661d1654e09.zip
gcc-328ba117bab9dfd05bfdde90d3673661d1654e09.tar.gz
gcc-328ba117bab9dfd05bfdde90d3673661d1654e09.tar.bz2
tree-vect-loop.c (vect_analyze_loop_2): Check and skip loop if it has no enough iterations for LOOP_VINFO_PEELING_FOR_GAPS.
* tree-vect-loop.c (vect_analyze_loop_2): Check and skip loop if it has no enough iterations for LOOP_VINFO_PEELING_FOR_GAPS. gcc/testsuite * gcc.dg/vect/vect-98.c: Refine test case. * gcc.dg/vect/vect-strided-a-u8-i8-gap2.c: Increase niters. * gcc.dg/vect/vect-strided-u8-i8-gap2.c: Ditto. * gcc.dg/vect/vect-strided-u8-i8-gap4.c: Ditto. From-SVN: r241097
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 7b0431e..be6f3fb 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -2059,6 +2059,25 @@ start_over:
return false;
}
+ /* If epilog loop is required because of data accesses with gaps,
+ one additional iteration needs to be peeled. Check if there is
+ enough iterations for vectorization. */
+ if (LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo)
+ && LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
+ {
+ int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
+ tree scalar_niters = LOOP_VINFO_NITERSM1 (loop_vinfo);
+
+ if (wi::to_widest (scalar_niters) < vf)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "loop has no enough iterations to support"
+ " peeling for gaps.\n");
+ return false;
+ }
+ }
+
/* Analyze cost. Decide if worth while to vectorize. */
int min_profitable_estimate, min_profitable_iters;
vect_estimate_min_profitable_iters (loop_vinfo, &min_profitable_iters,