]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/tree-ssa-forwprop.c
c++: Handle multiple aggregate overloads [PR95319].
[thirdparty/gcc.git] / gcc / tree-ssa-forwprop.c
index 8ee5450b94cc704a374d153256cbed82d9403be3..759baf568978b3201ef1f744fa4d446d3daf12fb 100644 (file)
@@ -2479,7 +2479,10 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
          tree src_type = TREE_TYPE (orig[0]);
          if (!useless_type_conversion_p (type, src_type))
            {
-             gcc_assert (!targetm.compatible_vector_types_p (type, src_type));
+             gcc_assert (known_eq (TYPE_VECTOR_SUBPARTS (type),
+                                   TYPE_VECTOR_SUBPARTS (src_type))
+                         && useless_type_conversion_p (TREE_TYPE (type),
+                                                       TREE_TYPE (src_type)));
              tree rhs = build1 (VIEW_CONVERT_EXPR, type, orig[0]);
              orig[0] = make_ssa_name (type);
              gassign *assign = gimple_build_assign (orig[0], rhs);
@@ -2611,7 +2614,10 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
        res = gimple_build (&stmts, conv_code, type, res);
       else if (!useless_type_conversion_p (type, TREE_TYPE (res)))
        {
-         gcc_assert (!targetm.compatible_vector_types_p (type, perm_type));
+         gcc_assert (known_eq (TYPE_VECTOR_SUBPARTS (type),
+                               TYPE_VECTOR_SUBPARTS (perm_type))
+                     && useless_type_conversion_p (TREE_TYPE (type),
+                                                   TREE_TYPE (perm_type)));
          res = gimple_build (&stmts, VIEW_CONVERT_EXPR, type, res);
        }
       /* Blend in the actual constant.  */
@@ -2757,18 +2763,18 @@ pass_forwprop::execute (function *fun)
 
          /* If this statement sets an SSA_NAME to an address,
             try to propagate the address into the uses of the SSA_NAME.  */
-         if (code == ADDR_EXPR
-             /* Handle pointer conversions on invariant addresses
-                as well, as this is valid gimple.  */
-             || (CONVERT_EXPR_CODE_P (code)
-                 && TREE_CODE (rhs) == ADDR_EXPR
-                 && POINTER_TYPE_P (TREE_TYPE (lhs))))
+         if ((code == ADDR_EXPR
+              /* Handle pointer conversions on invariant addresses
+                 as well, as this is valid gimple.  */
+              || (CONVERT_EXPR_CODE_P (code)
+                  && TREE_CODE (rhs) == ADDR_EXPR
+                  && POINTER_TYPE_P (TREE_TYPE (lhs))))
+             && TREE_CODE (TREE_OPERAND (rhs, 0)) != TARGET_MEM_REF)
            {
              tree base = get_base_address (TREE_OPERAND (rhs, 0));
              if ((!base
                   || !DECL_P (base)
                   || decl_address_invariant_p (base))
-                 && TREE_CODE (base) != TARGET_MEM_REF
                  && !stmt_references_abnormal_ssa_name (stmt)
                  && forward_propagate_addr_expr (lhs, rhs, true))
                {
@@ -2956,6 +2962,8 @@ pass_forwprop::execute (function *fun)
                      != TARGET_MEM_REF))
                {
                  tree use_lhs = gimple_assign_lhs (use_stmt);
+                 if (auto_var_p (use_lhs))
+                   DECL_NOT_GIMPLE_REG_P (use_lhs) = 1;
                  tree new_lhs = build1 (REALPART_EXPR,
                                         TREE_TYPE (TREE_TYPE (use_lhs)),
                                         unshare_expr (use_lhs));
@@ -3007,6 +3015,9 @@ pass_forwprop::execute (function *fun)
                    = tree_to_uhwi (TYPE_SIZE (elt_t));
                  unsigned HOST_WIDE_INT n
                    = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (rhs)));
+                 tree use_lhs = gimple_assign_lhs (use_stmt);
+                 if (auto_var_p (use_lhs))
+                   DECL_NOT_GIMPLE_REG_P (use_lhs) = 1;
                  for (unsigned HOST_WIDE_INT bi = 0; bi < n; bi += elt_w)
                    {
                      unsigned HOST_WIDE_INT ci = bi / elt_w;
@@ -3015,7 +3026,6 @@ pass_forwprop::execute (function *fun)
                        new_rhs = CONSTRUCTOR_ELT (rhs, ci)->value;
                      else
                        new_rhs = build_zero_cst (elt_t);
-                     tree use_lhs = gimple_assign_lhs (use_stmt);
                      tree new_lhs = build3 (BIT_FIELD_REF,
                                             elt_t,
                                             unshare_expr (use_lhs),