Consistently pass the vector type for scalar SLP cost compute
authorRichard Biener <rguenther@suse.de>
Thu, 29 Oct 2020 11:21:41 +0000 (12:21 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 29 Oct 2020 12:09:49 +0000 (13:09 +0100)
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.

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

index 0a7b8e616320b8eb01cf88042f49d702741aa798..7a08908cde87db88f35e5d0f08063e0971e2c2a7 100644 (file)
@@ -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;