Message ID | 20131203165303.GB10613@virgil.suse |
---|---|
State | New |
Headers | show |
On 12/03/13 09:53, Martin Jambor wrote: > Hi, > > the patch below fixes a failure on the epiphany target where callers > and callees do not agree on registers for parameter passing because > they see different alignment of actual arguments and formal parameters > (there is some more information on this in bugzilla). The actual > arguments are SSA names - created by force_gimple_operand_gsi in > ipa_modify_call_arguments - which are of a naturally aligned type > while formal parameters are PARM_DECLs - directly built in > ipa_modify_formal_parameters - of the types specified in > ipa_parm_adjustment_vec which may not be aligned. > > Because we use the alignment of types in ipa_parm_adjustment_vec to > signal to ipa_modify_call_arguments that it needs to built unaligned > MEM_REFs, it is ipa_modify_formal_parameters that has to fix up the > PARM_DECLs in cases where callers will produce SSA_NAMES, i.e. when > the type is a gimple_register_type. That's what the patch below > does. > > Bootstrapped and tested on x86_64-linux, only a slightly different > patch also passed bootstrap on ppc64-linux and has been confirmed to > fix the problem on epiphany. OK for trunk? > > Thanks, > > Martin > > > 2013-11-28 Martin Jambor <mjambor@suse.cz> > > PR ipa/58253 > * ipa-prop.c (ipa_modify_formal_parameters): Create decls of > non-BLKmode in their naturally aligned type. OK for the trunk. jeff
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 712dab7..83dc53e 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -3444,7 +3444,15 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments) if (adj->by_ref) ptype = build_pointer_type (adj->type); else - ptype = adj->type; + { + ptype = adj->type; + if (is_gimple_reg_type (ptype)) + { + unsigned malign = GET_MODE_ALIGNMENT (TYPE_MODE (ptype)); + if (TYPE_ALIGN (ptype) < malign) + ptype = build_aligned_type (ptype, malign); + } + } if (care_for_types) new_arg_types = tree_cons (NULL_TREE, ptype, new_arg_types);