]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-vect-loop.c (vect_analyze_loop_operations): Do not vectorize loops that can...
authorRichard Guenther <rguenther@suse.de>
Fri, 20 Apr 2012 08:19:49 +0000 (08:19 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 20 Apr 2012 08:19:49 +0000 (08:19 +0000)
2012-04-20  Richard Guenther  <rguenther@suse.de>

* tree-vect-loop.c (vect_analyze_loop_operations): Do not
vectorize loops that can never run more often than the
vectorization factor.

From-SVN: r186614

gcc/ChangeLog
gcc/tree-vect-loop.c

index a91416f7adb432d86ab27cfb1cf24db1b73a5953..fa687185583b38cf41574f6ebbccb3fc979d35cc 100644 (file)
@@ -1,3 +1,9 @@
+2012-04-20  Richard Guenther  <rguenther@suse.de>
+
+       * tree-vect-loop.c (vect_analyze_loop_operations): Do not
+       vectorize loops that can never run more often than the
+       vectorization factor.
+
 2012-04-19  Jan Hubicka  <jh@suse.cz>
 
        * symtab.c (dump_symtab_base): Fix dumping of asm lists.
index 91a982957595d7eb35347ce1a30600ea98e0324d..0c6ed39c12324b182d0f0efafdbf37da574b2bea 100644 (file)
@@ -1235,6 +1235,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
   int min_scalar_loop_bound;
   unsigned int th;
   bool only_slp_in_loop = true, ok;
+  HOST_WIDE_INT max_niter;
 
   if (vect_print_dump_info (REPORT_DETAILS))
     fprintf (vect_dump, "=== vect_analyze_loop_operations ===");
@@ -1407,8 +1408,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
         "vectorization_factor = %d, niters = " HOST_WIDE_INT_PRINT_DEC,
         vectorization_factor, LOOP_VINFO_INT_NITERS (loop_vinfo));
 
-  if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
-      && (LOOP_VINFO_INT_NITERS (loop_vinfo) < vectorization_factor))
+  if ((LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+       && (LOOP_VINFO_INT_NITERS (loop_vinfo) < vectorization_factor))
+      || ((max_niter = max_stmt_executions_int (loop)) != -1
+         && max_niter < vectorization_factor))
     {
       if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
         fprintf (vect_dump, "not vectorized: iteration count too small.");