tree-optimization/97020 - account SLP cost in loop vect again
authorRichard Biener <rguenther@suse.de>
Fri, 11 Sep 2020 11:51:58 +0000 (13:51 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 11 Sep 2020 11:53:34 +0000 (13:53 +0200)
The previous re-org made the cost of SLP vector stmts in loop
vectorization ignored.  The following rectifies this mistake.

2020-09-11  Richard Biener  <rguenther@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

index 519cd6a725415447aeea0904a8576a909eeed9ac..15912515caaeed6559d7fe6e397552aa701f939e 100644 (file)
@@ -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 ();
+           }
        }
     }