diff mbox series

Consistently pass the vector type for scalar SLP cost compute

Message ID nycvar.YFH.7.76.2010291234020.3652@elmra.sevgm.obk
State New
Headers show
Series Consistently pass the vector type for scalar SLP cost compute | expand

Commit Message

Richard Biener Oct. 29, 2020, 11:34 a.m. UTC
This avoids randomly (based on whether the stmt is
SLP_TREE_REPRESENTATIVE and not a pattern stmt) passing a vector
type or NULL to the add_stmt_cost hook for scalar code cost
compute.  For example the x86 backend uses only the vector type to
decide on the scalar computation mode which makes costing off.

So the following explicitely passes the vector type and uses
SLP_TREE_VECTYPE for this purpose.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

2020-10-29  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (vect_bb_slp_scalar_cost): Pass
	SLP_TREE_VECTYPE to record_stmt_cost.
---
 gcc/tree-vect-slp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 0a7b8e61632..7a08908cde8 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -3937,7 +3937,8 @@  vect_bb_slp_scalar_cost (vec_info *vinfo,
 	continue;
       else
 	kind = scalar_stmt;
-      record_stmt_cost (cost_vec, 1, kind, orig_stmt_info, 0, vect_body);
+      record_stmt_cost (cost_vec, 1, kind, orig_stmt_info,
+			SLP_TREE_VECTYPE (node), 0, vect_body);
     }
 
   auto_vec<bool, 20> subtree_life;