diff mbox series

tree-optimization/99017 - be more forgiving in BB vect costing

Message ID nycvar.YFH.7.76.2102091012570.3630@elmra.sevgm.obk
State New
Headers show
Series tree-optimization/99017 - be more forgiving in BB vect costing | expand

Commit Message

Richard Biener Feb. 9, 2021, 9:13 a.m. UTC
This works around a SLP graph partitioning or cost collecting issue
by being more forgiving in vect_bb_vectorization_profitable_p.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

2021-02-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/99017
	* tree-vect-slp.c (vect_bb_vectorization_profitable_p): Allow
	zero vector cost entries.
---
 gcc/tree-vect-slp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index b9f12c30fb8..ea8a97b01c6 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -4427,7 +4427,8 @@  vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo,
   /* Now cost the portions individually.  */
   unsigned vi = 0;
   unsigned si = 0;
-  do
+  while (si < li_scalar_costs.length ()
+	 && vi < li_vector_costs.length ())
     {
       unsigned sl = li_scalar_costs[si].first;
       unsigned vl = li_vector_costs[vi].first;
@@ -4497,8 +4498,6 @@  vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo,
 	  return false;
 	}
     }
-  while (si < li_scalar_costs.length ()
-	 && vi < li_vector_costs.length ());
   if (vi < li_vector_costs.length ())
     {
       if (dump_enabled_p ())