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?
Ciao,
Michael.
* cfgexpand.c (expand_one_register_var): Use get_pointer_alignment.
(gimple_expand_cfg): Merge alignment info for coalesced pointer
SSA names.
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)