This is an automated email from the git hooks/post-receive script.
unknown user pushed a commit to branch aoliva/pr64164 in repository gcc.
commit 9357ff1c60c956132c905678bbbab641d7b59743 Author: Alexandre Oliva aoliva@redhat.com Date: Sun Aug 2 07:08:46 2015 -0300
further adjustments to handling of byref parms --- gcc/cfgexpand.c | 23 ++++++++++++++++------- gcc/function.c | 17 ++++++++++++----- 2 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 5b89359..8f6caf6 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -193,6 +193,19 @@ parm_maybe_byref_p (tree var) return TYPE_MODE (TREE_TYPE (var)) == BLKmode; }
+/* Return the partition of the default SSA_DEF for decl VAR. */ + +static int +ssa_default_def_partition (tree var) +{ + tree name = ssa_default_def (cfun, var); + + if (!name) + return NO_PARTITION; + + return var_to_partition (SA.map, name); +} + /* Return the RTL for the default SSA def of a PARM or RESULT, if there is one. */
@@ -220,12 +233,7 @@ get_rtl_for_parm_ssa_default_def (tree var) return DECL_RTL (var); }
- tree name = ssa_default_def (cfun, var); - - if (!name) - return NULL_RTX; - - int part = var_to_partition (SA.map, name); + int part = ssa_default_def_partition (var); if (part == NO_PARTITION) return NULL_RTX;
@@ -1335,7 +1343,8 @@ expand_one_ssa_partition (tree var)
if (!use_register_for_decl (var)) { - if (parm_maybe_byref_p (SSA_NAME_VAR (var))) + if (parm_maybe_byref_p (SSA_NAME_VAR (var)) + && ssa_default_def_partition (SSA_NAME_VAR (var)) == part) { expand_one_stack_var_at (var, pc_rtx, 0, 0); rtx x = SA.partition_to_pseudo[part]; diff --git a/gcc/function.c b/gcc/function.c index abbffc5..9447d51 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -3162,6 +3162,7 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tree parm,
need_conversion = (data->nominal_mode != data->passed_mode || promoted_nominal_mode != data->promoted_mode); + gcc_assert (!(need_conversion && data->passed_pointer)); moved = false;
if (need_conversion @@ -3293,7 +3294,9 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tree parm,
did_conversion = true; } - else + /* We don't want to copy the incoming pointer to a parmreg expected + to hold the value rather than the pointer. */ + else if (!data->passed_pointer || parmreg != from_expand) emit_move_insn (parmreg, validated_mem);
/* If we were passed a pointer but the actual value can safely live @@ -3301,12 +3304,16 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tr [...] if (data->passed_pointer && (from_expand || TYPE_MODE (TREE_TYPE (parm)) != BLKmode)) { + rtx src = DECL_RTL (parm); + /* We can't use nominal_mode, because it will have been set to Pmode above. We must use the actual mode of the parm. */ if (from_expand) { parmreg = from_expand; gcc_assert (GET_MODE (parmreg) == TYPE_MODE (TREE_TYPE (parm))); + src = gen_rtx_MEM (GET_MODE (parmreg), validated_mem); + set_mem_attributes (src, parm, 1); } else if (use_register_for_decl (parm)) { @@ -3325,14 +3332,14 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tr [...] set_mem_attributes (parmreg, parm, 1); }
- if (GET_MODE (parmreg) != GET_MODE (DECL_RTL (parm))) + if (GET_MODE (parmreg) != GET_MODE (src)) { - rtx tempreg = gen_reg_rtx (GET_MODE (DECL_RTL (parm))); + rtx tempreg = gen_reg_rtx (GET_MODE (src)); int unsigned_p = TYPE_UNSIGNED (TREE_TYPE (parm));
push_to_sequence2 (all->first_conversion_insn, all->last_conversion_insn); - emit_move_insn (tempreg, DECL_RTL (parm)); + emit_move_insn (tempreg, src); tempreg = convert_to_mode (GET_MODE (parmreg), tempreg, unsigned_p); emit_move_insn (parmreg, tempreg); all->first_conversion_insn = get_insns (); @@ -3344,7 +3351,7 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tree parm, else if (GET_MODE (parmreg) == BLKmode) gcc_assert (parm_maybe_byref_p (parm)); else - emit_move_insn (parmreg, DECL_RTL (parm)); + emit_move_insn (parmreg, src);
SET_DECL_RTL (parm, parmreg);