Message ID | Pine.LNX.4.64.1107261754270.25049@wotan.suse.de |
---|---|
State | New |
Headers | show |
Hi, On Tue, 26 Jul 2011, Michael Matz wrote: > On Tue, 26 Jul 2011, Michael Matz wrote: > > > Hi, > > > > On Tue, 26 Jul 2011, Ulrich Weigand wrote: > > > > > > Well, REG_ATTRS->decl is again a decl, not an SSA name. I suppose > > > > we'd need to pick a conservative REGNO_POINTER_ALIGN during > > > > expansion of the SSA name partition - iterate over all of them in the > > > > partition and pick the lowest alignment. Or even adjust the partitioning > > > > to avoid losing alignment information that way. > > > > > > That would certainly be helpful. > > > > I'm working on a patch for that, stay tuned. > > Like so. Currently in regstrapping on x86_64-linux. Could you try if it > helps spu? > > Okay for trunk? This patch exposes a problem in libada. But I'd still be interested if it fixes the spu problem. Ciao, Michael.
On Tue, Jul 26, 2011 at 6:56 PM, Ulrich Weigand <uweigand@de.ibm.com> wrote: > Michael Matz wrote: >> On Tue, 26 Jul 2011, Michael Matz wrote: >> > On Tue, 26 Jul 2011, Ulrich Weigand wrote: >> > >> > > > Well, REG_ATTRS->decl is again a decl, not an SSA name. I suppose >> > > > we'd need to pick a conservative REGNO_POINTER_ALIGN during >> > > > expansion of the SSA name partition - iterate over all of them in the >> > > > partition and pick the lowest alignment. Or even adjust the partitioning >> > > > to avoid losing alignment information that way. >> > > >> > > That would certainly be helpful. >> > >> > I'm working on a patch for that, stay tuned. >> >> Like so. Currently in regstrapping on x86_64-linux. Could you try if it >> helps spu? > > Well, it does help SPU in the sense that the wrong code generation goes away. > > However, it does so by setting REGNO_POINTER_ALIGN to the minimum of 8 just > about every time -- not sure what the impact on generated code quality is. > > Maybe get_pointer_alignment should default to the type's alignment if > nothing more specific is known, at least on STRICT_ALIGNMENT targets? > Just like MEM_ALIGN defaults to the mode's alignment ... Which is bogus ... instead we should improve alignment tracking to take into account more sources of alignment information (it is very conservative right now - for a reason, of course, as we get most of the packed/aligned attribute stuff wrong from the frontend already as soon as pointers are involved). Richard. > Thanks, > Ulrich > > -- > Dr. Ulrich Weigand > GNU Toolchain for Linux on System z and Cell BE > Ulrich.Weigand@de.ibm.com >
Index: cfgexpand.c =================================================================== --- cfgexpand.c (revision 176790) +++ cfgexpand.c (working copy) @@ -909,7 +909,7 @@ expand_one_register_var (tree var) mark_user_reg (x); if (POINTER_TYPE_P (type)) - mark_reg_pointer (x, TYPE_ALIGN (TREE_TYPE (type))); + mark_reg_pointer (x, get_pointer_alignment (var, BIGGEST_ALIGNMENT)); } /* A subroutine of expand_one_var. Called to assign rtl to a VAR_DECL that @@ -4265,6 +4265,25 @@ gimple_expand_cfg (void) } } + /* If we have a class containing differently aligned pointers + we need to merge those into the corresponding RTL pointer + alignment. */ + for (i = 1; i < num_ssa_names; i++) + { + tree name = ssa_name (i); + int part; + rtx r; + + if (!name || !POINTER_TYPE_P (TREE_TYPE (name))) + continue; + part = var_to_partition (SA.map, name); + if (part == NO_PARTITION) + continue; + r = SA.partition_to_pseudo[part]; + if (REG_P (r)) + mark_reg_pointer (r, get_pointer_alignment (name, BIGGEST_ALIGNMENT)); + } + /* If this function is `main', emit a call to `__main' to run global initializers, etc. */ if (DECL_NAME (current_function_decl)