re PR tree-optimization/81303 (410.bwaves regression caused by r249919)
authorRichard Biener <rguenther@suse.de>
Tue, 25 Jul 2017 10:59:15 +0000 (10:59 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 25 Jul 2017 10:59:15 +0000 (10:59 +0000)
2017-07-25  Richard Biener  <rguenther@suse.de>

PR tree-optimization/81303
* tree-vect-loop-manip.c (vect_loop_versioning): Build
profitability check against LOOP_VINFO_NITERSM1.

From-SVN: r250503

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

index 42697c510a9d1ca911f180d953e2c78f24d6e320..82c7edc595d92b95dd13a02ed90263d592d542e8 100644 (file)
@@ -1,3 +1,9 @@
+2017-07-25  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/81303
+       * tree-vect-loop-manip.c (vect_loop_versioning): Build
+       profitability check against LOOP_VINFO_NITERSM1.
+
 2017-07-25  Alexander Monakov  <amonakov@ispras.ru>
 
        * domwalk.c (cmp_bb_postorder): Simplify.
index b76b515a788886115bd59c20b29a364c765d828f..97080a61ff78c80d4c7cc74710a173c2504220c6 100644 (file)
@@ -2136,7 +2136,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
   tree arg;
   profile_probability prob = profile_probability::likely ();
   gimple_seq gimplify_stmt_list = NULL;
-  tree scalar_loop_iters = LOOP_VINFO_NITERS (loop_vinfo);
+  tree scalar_loop_iters = LOOP_VINFO_NITERSM1 (loop_vinfo);
   bool version_align = LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo);
   bool version_alias = LOOP_REQUIRES_VERSIONING_FOR_ALIAS (loop_vinfo);
   bool version_niter = LOOP_REQUIRES_VERSIONING_FOR_NITERS (loop_vinfo);
@@ -2144,7 +2144,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
   if (check_profitability)
     cond_expr = fold_build2 (GE_EXPR, boolean_type_node, scalar_loop_iters,
                             build_int_cst (TREE_TYPE (scalar_loop_iters),
-                                                      th));
+                                           th - 1));
 
   if (version_niter)
     vect_create_cond_for_niters_checks (loop_vinfo, &cond_expr);