diff mbox series

Adjust BB vect from-scalar build

Message ID nycvar.YFH.7.76.1910230842080.5566@zhemvz.fhfr.qr
State New
Headers show
Series Adjust BB vect from-scalar build | expand

Commit Message

Richard Biener Oct. 23, 2019, 6:44 a.m. UTC
After the latest changes we now end up building more SLP nodes from
scalars - the fact that we have SLP childs for externals triggers this
for the case where previously all ops were external (no scalar build
was considered).  The following adjusts the heuristic to treat
constant operands as profitable to vectorize (we can at least use
a vector load from the constant pool).

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

Richard.

2019-10-23  Richard Biener  <rguenther@suse.de>

	* tree-vect-slp.c (vect_build_slp_tree_2): Do not build
	op from scalars in case there's a constant operand in its
	definition.
diff mbox series

Patch

Index: gcc/tree-vect-slp.c
===================================================================
--- gcc/tree-vect-slp.c	(revision 277288)
+++ gcc/tree-vect-slp.c	(working copy)
@@ -1291,7 +1291,7 @@  vect_build_slp_tree_2 (vec_info *vinfo,
 	      slp_tree grandchild;
 
 	      FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (child), j, grandchild)
-		if (SLP_TREE_DEF_TYPE (grandchild) == vect_internal_def)
+		if (SLP_TREE_DEF_TYPE (grandchild) != vect_external_def)
 		  break;
 	      if (!grandchild)
 		{
@@ -1450,7 +1450,7 @@  vect_build_slp_tree_2 (vec_info *vinfo,
 		  slp_tree grandchild;
 
 		  FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (child), j, grandchild)
-		    if (SLP_TREE_DEF_TYPE (grandchild) == vect_internal_def)
+		    if (SLP_TREE_DEF_TYPE (grandchild) != vect_external_def)
 		      break;
 		  if (!grandchild)
 		    {