More BB vectorization tweaks
authorRichard Biener <rguenther@suse.de>
Thu, 29 Oct 2020 07:48:15 +0000 (08:48 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 29 Oct 2020 08:40:03 +0000 (09:40 +0100)
This tweaks the op build from splats to allow loads marked as not
vectorizable.  It also amends some dump prints with the address of
the SLP node or the instance to better be able to debug things.

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

* tree-vect-slp.c (vect_build_slp_tree_2): Allow splatting
not vectorizable loads.
(vect_build_slp_instance): Amend dumping with address.
(vect_slp_convert_to_external): Likewise.

* gcc.dg/vect/bb-slp-pr65935.c: Adjust.

gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c
gcc/tree-vect-slp.c

index ea37e4e614cecbf4a13ea48f2b8cee8698f2ac62..c262d731150ccb0953fce77e70cc2ad2f92f049e 100644 (file)
@@ -60,6 +60,7 @@ int main()
 /* We should also be able to use 2-lane SLP to initialize the real and
    imaginary components in the first loop of main.  */
 /* { dg-final { scan-tree-dump-times "optimized: basic block" 10 "slp1" } } */
-/* We should see the s->phase[dir] operand and only that operand built
+/* We should see the s->phase[dir] operand splatted and no other operand built
    from scalars.  See PR97334.  */
-/* { dg-final { scan-tree-dump-times "Building vector operands from scalars" 1 "slp1" } } */
+/* { dg-final { scan-tree-dump-times "Using a splat" 1 "slp1" } } */
+/* { dg-final { scan-tree-dump-times "Building vector operands from scalars" 0 "slp1" } } */
index ff3a0c2fd8e6792137ec04d2ba8597b764a9ec80..0a7b8e616320b8eb01cf88042f49d702741aa798 100644 (file)
@@ -1627,8 +1627,10 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
              break;
          if (j == group_size
              /* But avoid doing this for loads where we may be
-                able to CSE things.  */
-             && !gimple_vuse (first_def->stmt))
+                able to CSE things, unless the stmt is not
+                vectorizable.  */
+             && (!STMT_VINFO_VECTORIZABLE (first_def)
+                 || !gimple_vuse (first_def->stmt)))
            {
              if (dump_enabled_p ())
                dump_printf_loc (MSG_NOTE, vect_location,
@@ -2379,7 +2381,7 @@ vect_build_slp_instance (vec_info *vinfo,
          if (dump_enabled_p ())
            {
              dump_printf_loc (MSG_NOTE, vect_location,
-                              "Final SLP tree for instance:\n");
+                              "Final SLP tree for instance %p:\n", new_instance);
              vect_print_slp_graph (MSG_NOTE, vect_location,
                                    SLP_INSTANCE_TREE (new_instance));
            }
@@ -3402,7 +3404,7 @@ vect_slp_convert_to_external (vec_info *vinfo, slp_tree node,
 
   if (dump_enabled_p ())
     dump_printf_loc (MSG_NOTE, vect_location,
-                    "Building vector operands from scalars instead\n");
+                    "Building vector operands of %p from scalars instead\n", node);
 
   /* Don't remove and free the child nodes here, since they could be
      referenced by other structures.  The analysis and scheduling phases