2015-05-27 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 May 2015 10:31:11 +0000 (10:31 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 May 2015 10:31:11 +0000 (10:31 +0000)
* tree-vect-stmts.c (vectorizable_load): Initialize slp_perm
earlier and remove ??? comment.
(vect_analyze_stmt): If we are analyzing a pure SLP stmt
and got called from loop analysis bail out.  Always pass the SLP
node to the vectorizable_* functions.
* tree-vect-loop.c (vect_analyze_loop_operations): Remove
the premature SLP check here.
* tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Dump hybrid
detected SLP stmts.
(vect_detect_hybrid_slp_1): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223743 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-vect-loop.c
gcc/tree-vect-slp.c
gcc/tree-vect-stmts.c

index bf90c86..ffde59c 100644 (file)
@@ -1,3 +1,16 @@
+2015-05-27  Richard Biener  <rguenther@suse.de>
+
+       * tree-vect-stmts.c (vectorizable_load): Initialize slp_perm
+       earlier and remove ??? comment.
+       (vect_analyze_stmt): If we are analyzing a pure SLP stmt
+       and got called from loop analysis bail out.  Always pass the SLP
+       node to the vectorizable_* functions.
+       * tree-vect-loop.c (vect_analyze_loop_operations): Remove
+       the premature SLP check here.
+       * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Dump hybrid
+       detected SLP stmts.
+       (vect_detect_hybrid_slp_1): Likewise.
+
 2015-05-26  Jeff Law  <law@redhat.com>
 
        * combine.c (find_split_point): Verify that the shift count is a
index 89202c4..b93685e 100644 (file)
@@ -1556,11 +1556,6 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
           gsi_next (&si))
         {
           gimple stmt = gsi_stmt (si);
-         if (STMT_SLP_TYPE (vinfo_for_stmt (stmt)))
-           {
-             need_to_vectorize = true;
-             continue;
-           }
          if (!gimple_clobber_p (stmt)
              && !vect_analyze_stmt (stmt, &need_to_vectorize, NULL))
            return false;
index 1e68020..214c96c 100644 (file)
@@ -2027,7 +2027,14 @@ vect_detect_hybrid_slp_stmts (slp_tree node, unsigned i, slp_vect_type stype)
     }
 
   if (stype == hybrid)
-    STMT_SLP_TYPE (stmt_vinfo) = hybrid;
+    {
+      if (dump_enabled_p ())
+       {
+         dump_printf_loc (MSG_NOTE, vect_location, "marking hybrid: ");
+         dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+       }
+      STMT_SLP_TYPE (stmt_vinfo) = hybrid;
+    }
 
   FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child)
     if (child)
@@ -2051,7 +2058,14 @@ vect_detect_hybrid_slp_1 (tree *tp, int *, void *data)
       gimple def_stmt = SSA_NAME_DEF_STMT (*tp);
       if (flow_bb_inside_loop_p (loopp, gimple_bb (def_stmt))
          && PURE_SLP_STMT (vinfo_for_stmt (def_stmt)))
-       STMT_SLP_TYPE (vinfo_for_stmt (def_stmt)) = hybrid;
+       {
+         if (dump_enabled_p ())
+           {
+             dump_printf_loc (MSG_NOTE, vect_location, "marking hybrid: ");
+             dump_gimple_stmt (MSG_NOTE, TDF_SLIM, def_stmt, 0);
+           }
+         STMT_SLP_TYPE (vinfo_for_stmt (def_stmt)) = hybrid;
+       }
     }
 
   return NULL_TREE;
index 83039f1..06a59cb 100644 (file)
@@ -5940,6 +5940,9 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
          return false;
        }
 
+      if (slp && SLP_TREE_LOAD_PERMUTATION (slp_node).exists ())
+       slp_perm = true;
+
       group_size = GROUP_SIZE (vinfo_for_stmt (first_stmt));
       if (!slp
          && !PURE_SLP_STMT (stmt_info)
@@ -6004,10 +6007,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
           && (slp || PURE_SLP_STMT (stmt_info)))
          && (group_size > nunits
              || nunits % group_size != 0
-             /* ???  During analysis phase we are not called with the
-                slp node/instance we are in so whether we'll end up
-                with a permutation we don't know.  Still we don't
-                support load permutations.  */
+             /* We don't support load permutations.  */
              || slp_perm))
        {
          dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -6402,8 +6402,6 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
        {
          grouped_load = false;
          vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
-          if (SLP_TREE_LOAD_PERMUTATION (slp_node).exists ())
-            slp_perm = true;
          group_gap = GROUP_GAP (vinfo_for_stmt (first_stmt));
        }
       else
@@ -7371,33 +7369,40 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
       *need_to_vectorize = true;
     }
 
-   ok = true;
-   if (!bb_vinfo
-       && (STMT_VINFO_RELEVANT_P (stmt_info)
-           || STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def))
-      ok = (vectorizable_simd_clone_call (stmt, NULL, NULL, NULL)
-           || vectorizable_conversion (stmt, NULL, NULL, NULL)
-            || vectorizable_shift (stmt, NULL, NULL, NULL)
-            || vectorizable_operation (stmt, NULL, NULL, NULL)
-            || vectorizable_assignment (stmt, NULL, NULL, NULL)
-            || vectorizable_load (stmt, NULL, NULL, NULL, NULL)
-           || vectorizable_call (stmt, NULL, NULL, NULL)
-            || vectorizable_store (stmt, NULL, NULL, NULL)
-            || vectorizable_reduction (stmt, NULL, NULL, NULL)
-            || vectorizable_condition (stmt, NULL, NULL, NULL, 0, NULL));
-    else
-      {
-        if (bb_vinfo)
-         ok = (vectorizable_simd_clone_call (stmt, NULL, NULL, node)
-               || vectorizable_conversion (stmt, NULL, NULL, node)
-               || vectorizable_shift (stmt, NULL, NULL, node)
-                || vectorizable_operation (stmt, NULL, NULL, node)
-                || vectorizable_assignment (stmt, NULL, NULL, node)
-                || vectorizable_load (stmt, NULL, NULL, node, NULL)
-               || vectorizable_call (stmt, NULL, NULL, node)
-                || vectorizable_store (stmt, NULL, NULL, node)
-                || vectorizable_condition (stmt, NULL, NULL, NULL, 0, node));
-      }
+  if (PURE_SLP_STMT (stmt_info) && !node)
+    {
+      dump_printf_loc (MSG_NOTE, vect_location,
+                      "handled only by SLP analysis\n");
+      return true;
+    }
+
+  ok = true;
+  if (!bb_vinfo
+      && (STMT_VINFO_RELEVANT_P (stmt_info)
+         || STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def))
+    ok = (vectorizable_simd_clone_call (stmt, NULL, NULL, node)
+         || vectorizable_conversion (stmt, NULL, NULL, node)
+         || vectorizable_shift (stmt, NULL, NULL, node)
+         || vectorizable_operation (stmt, NULL, NULL, node)
+         || vectorizable_assignment (stmt, NULL, NULL, node)
+         || vectorizable_load (stmt, NULL, NULL, node, NULL)
+         || vectorizable_call (stmt, NULL, NULL, node)
+         || vectorizable_store (stmt, NULL, NULL, node)
+         || vectorizable_reduction (stmt, NULL, NULL, node)
+         || vectorizable_condition (stmt, NULL, NULL, NULL, 0, node));
+  else
+    {
+      if (bb_vinfo)
+       ok = (vectorizable_simd_clone_call (stmt, NULL, NULL, node)
+             || vectorizable_conversion (stmt, NULL, NULL, node)
+             || vectorizable_shift (stmt, NULL, NULL, node)
+             || vectorizable_operation (stmt, NULL, NULL, node)
+             || vectorizable_assignment (stmt, NULL, NULL, node)
+             || vectorizable_load (stmt, NULL, NULL, node, NULL)
+             || vectorizable_call (stmt, NULL, NULL, node)
+             || vectorizable_store (stmt, NULL, NULL, node)
+             || vectorizable_condition (stmt, NULL, NULL, NULL, 0, node));
+    }
 
   if (!ok)
     {