aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2020-06-17 07:50:57 -0400
committerAldy Hernandez <aldyh@redhat.com>2020-06-17 07:50:57 -0400
commitb9e67f2840ce0d8859d96e7f8df8fe9584af5eba (patch)
treeed3b7284ff15c802583f6409b9c71b3739642d15 /gcc/tree-ssa.c
parent1957047ed1c94bf17cf993a2b1866965f493ba87 (diff)
parent56638b9b1853666f575928f8baf17f70e4ed3517 (diff)
downloadgcc-b9e67f2840ce0d8859d96e7f8df8fe9584af5eba.zip
gcc-b9e67f2840ce0d8859d96e7f8df8fe9584af5eba.tar.gz
gcc-b9e67f2840ce0d8859d96e7f8df8fe9584af5eba.tar.bz2
Merge from trunk at:
commit 56638b9b1853666f575928f8baf17f70e4ed3517 Author: GCC Administrator <gccadmin@gcc.gnu.org> Date: Wed Jun 17 00:16:36 2020 +0000 Daily bump.
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r--gcc/tree-ssa.c76
1 files changed, 42 insertions, 34 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index dbff604..c47b963 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1543,14 +1543,17 @@ non_rewritable_lvalue_p (tree lhs)
&& known_gt (wi::to_poly_offset (TYPE_SIZE_UNIT (TREE_TYPE (decl))),
mem_ref_offset (lhs))
&& multiple_of_p (sizetype, TREE_OPERAND (lhs, 1),
- TYPE_SIZE_UNIT (TREE_TYPE (lhs))))
+ TYPE_SIZE_UNIT (TREE_TYPE (lhs)))
+ && known_ge (wi::to_poly_offset (TYPE_SIZE (TREE_TYPE (decl))),
+ wi::to_poly_offset (TYPE_SIZE (TREE_TYPE (lhs)))))
{
poly_uint64 lhs_bits, nelts;
if (poly_int_tree_p (TYPE_SIZE (TREE_TYPE (lhs)), &lhs_bits)
&& multiple_p (lhs_bits,
tree_to_uhwi
(TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl)))),
- &nelts))
+ &nelts)
+ && valid_vector_subparts_p (nelts))
{
if (known_eq (nelts, 1u))
return false;
@@ -1580,8 +1583,8 @@ non_rewritable_lvalue_p (tree lhs)
return true;
}
-/* When possible, clear TREE_ADDRESSABLE bit or set DECL_GIMPLE_REG_P bit and
- mark the variable VAR for conversion into SSA. Return true when updating
+/* When possible, clear TREE_ADDRESSABLE bit, set or clear DECL_NOT_GIMPLE_REG_P
+ and mark the variable VAR for conversion into SSA. Return true when updating
stmts is required. */
static void
@@ -1594,24 +1597,11 @@ maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs,
|| bitmap_bit_p (addresses_taken, DECL_UID (var)))
return;
- if (TREE_ADDRESSABLE (var)
- /* Do not change TREE_ADDRESSABLE if we need to preserve var as
- a non-register. Otherwise we are confused and forget to
- add virtual operands for it. */
- && (!is_gimple_reg_type (TREE_TYPE (var))
- || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE
- || TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE
- || !bitmap_bit_p (not_reg_needs, DECL_UID (var))))
+ bool maybe_reg = false;
+ if (TREE_ADDRESSABLE (var))
{
TREE_ADDRESSABLE (var) = 0;
- /* If we cleared TREE_ADDRESSABLE make sure DECL_GIMPLE_REG_P
- is unset if we cannot rewrite the var into SSA. */
- if ((TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE
- || TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE)
- && bitmap_bit_p (not_reg_needs, DECL_UID (var)))
- DECL_GIMPLE_REG_P (var) = 0;
- if (is_gimple_reg (var))
- bitmap_set_bit (suitable_for_renaming, DECL_UID (var));
+ maybe_reg = true;
if (dump_file)
{
fprintf (dump_file, "No longer having address taken: ");
@@ -1620,20 +1610,36 @@ maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs,
}
}
- if (!DECL_GIMPLE_REG_P (var)
- && !bitmap_bit_p (not_reg_needs, DECL_UID (var))
- && (TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE
- || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE)
- && !TREE_THIS_VOLATILE (var)
- && (!VAR_P (var) || !DECL_HARD_REGISTER (var)))
+ /* For register type decls if we do not have any partial defs
+ we cannot express in SSA form mark them as DECL_NOT_GIMPLE_REG_P
+ as to avoid SSA rewrite. For the others go ahead and mark
+ them for renaming. */
+ if (is_gimple_reg_type (TREE_TYPE (var)))
{
- DECL_GIMPLE_REG_P (var) = 1;
- bitmap_set_bit (suitable_for_renaming, DECL_UID (var));
- if (dump_file)
+ if (bitmap_bit_p (not_reg_needs, DECL_UID (var)))
{
- fprintf (dump_file, "Now a gimple register: ");
- print_generic_expr (dump_file, var);
- fprintf (dump_file, "\n");
+ DECL_NOT_GIMPLE_REG_P (var) = 1;
+ if (dump_file)
+ {
+ fprintf (dump_file, "Has partial defs: ");
+ print_generic_expr (dump_file, var);
+ fprintf (dump_file, "\n");
+ }
+ }
+ else if (DECL_NOT_GIMPLE_REG_P (var))
+ {
+ maybe_reg = true;
+ DECL_NOT_GIMPLE_REG_P (var) = 0;
+ }
+ if (maybe_reg && is_gimple_reg (var))
+ {
+ if (dump_file)
+ {
+ fprintf (dump_file, "Now a gimple register: ");
+ print_generic_expr (dump_file, var);
+ fprintf (dump_file, "\n");
+ }
+ bitmap_set_bit (suitable_for_renaming, DECL_UID (var));
}
}
}
@@ -1666,7 +1672,8 @@ is_asan_mark_p (gimple *stmt)
return false;
}
-/* Compute TREE_ADDRESSABLE and DECL_GIMPLE_REG_P for local variables. */
+/* Compute TREE_ADDRESSABLE and whether we have unhandled partial defs
+ for local variables. */
void
execute_update_addresses_taken (void)
@@ -1925,7 +1932,8 @@ execute_update_addresses_taken (void)
(TYPE_SIZE (TREE_TYPE
(TREE_TYPE (sym)))),
&nelts)
- && maybe_ne (nelts, 1u))
+ && maybe_ne (nelts, 1u)
+ && valid_vector_subparts_p (nelts))
temtype = build_vector_type (temtype, nelts);
tree tem = make_ssa_name (temtype);
gimple *pun