The previous re-org made the cost of SLP vector stmts in loop
vectorization ignored.  The following rectifies this mistake.

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

2020-09-11  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/97020
        * tree-vect-slp.c (vect_slp_analyze_operations): Apply
        SLP costs when doing loop vectorization.
---
 gcc/tree-vect-slp.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 519cd6a7254..15912515caa 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -3163,8 +3163,15 @@ vect_slp_analyze_operations (vec_info *vinfo)
            visited.add (*x);
          i++;
 
-         /* Remember the SLP graph entry cost for later.  */
-         instance->cost_vec = cost_vec;
+         /* For BB vectorization remember the SLP graph entry
+            cost for later.  */
+         if (is_a <bb_vec_info> (vinfo))
+           instance->cost_vec = cost_vec;
+         else
+           {
+             add_stmt_costs (vinfo, vinfo->target_cost_data, &cost_vec);
+             cost_vec.release ();
+           }
        }
     }
 
-- 
2.26.2

Reply via email to