This moves the BIT_FIELD_REF handling check out from i == 0
processing.

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

        * tree-vect-slp.cc (vect_build_slp_tree_12): Check
        unsupported BIT_FIELD_REFs for all stmts.
---
 gcc/tree-vect-slp.cc | 44 +++++++++++++++++++++++---------------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 8162df180c6..c0303627579 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1293,6 +1293,29 @@ vect_build_slp_tree_12 (vec_info *vinfo, unsigned char 
*swap,
          return false;
        }
 
+      if (!ldst_p && rhs_code == BIT_FIELD_REF)
+       {
+         tree vec = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
+         if (!is_a <bb_vec_info> (vinfo)
+             || TREE_CODE (vec) != SSA_NAME
+             /* When the element types are not compatible we pun the
+                source to the target vectype which requires equal size.  */
+             || ((!VECTOR_TYPE_P (TREE_TYPE (vec))
+                  || !types_compatible_p (TREE_TYPE (vectype),
+                                          TREE_TYPE (TREE_TYPE (vec))))
+                 && !operand_equal_p (TYPE_SIZE (vectype),
+                                      TYPE_SIZE (TREE_TYPE (vec)))))
+           {
+             if (dump_enabled_p ())
+               dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+                                "Build SLP failed: "
+                                "BIT_FIELD_REF not supported\n");
+             if (i != 0)
+               continue;
+             return false;
+           }
+       }
+
       /* Check the operation.  */
       if (i == 0)
        {
@@ -1324,27 +1347,6 @@ vect_build_slp_tree_12 (vec_info *vinfo, unsigned char 
*swap,
               need_same_oprnds = true;
               first_op1 = gimple_assign_rhs2 (stmt);
             }
-         else if (!ldst_p
-                  && rhs_code == BIT_FIELD_REF)
-           {
-             tree vec = TREE_OPERAND (gimple_assign_rhs1 (stmt), 0);
-             if (!is_a <bb_vec_info> (vinfo)
-                 || TREE_CODE (vec) != SSA_NAME
-                 /* When the element types are not compatible we pun the
-                    source to the target vectype which requires equal size.  */
-                 || ((!VECTOR_TYPE_P (TREE_TYPE (vec))
-                      || !types_compatible_p (TREE_TYPE (vectype),
-                                              TREE_TYPE (TREE_TYPE (vec))))
-                     && !operand_equal_p (TYPE_SIZE (vectype),
-                                          TYPE_SIZE (TREE_TYPE (vec)))))
-               {
-                 if (dump_enabled_p ())
-                   dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
-                                    "Build SLP failed: "
-                                    "BIT_FIELD_REF not supported\n");
-                 return false;
-               }
-           }
          else if (rhs_code == CFN_DIV_POW2)
            {
              need_same_oprnds = true;
-- 
2.51.0

Reply via email to