[Bug tree-optimization/50444] [4.6/4.7 Regression] -ftree-sra ignores alignment
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jan 16 15:58:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50444
--- Comment #13 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-16 15:41:50 UTC ---
Or, transfering the alignment:
Index: tree-sra.c
===================================================================
--- tree-sra.c (revision 183205)
+++ tree-sra.c (working copy)
@@ -2294,15 +2294,17 @@ propagate_subaccesses_across_link (struc
{
tree t = lacc->base;
- lacc->type = racc->type;
- if (build_user_friendly_ref_for_offset (&t, TREE_TYPE (t),
- lacc->offset, racc->type))
+ if (lacc->type == racc->type
+ && build_user_friendly_ref_for_offset (&t, TREE_TYPE (t),
+ lacc->offset, lacc->type))
lacc->expr = t;
else
{
- lacc->expr = build_ref_for_model (EXPR_LOCATION (lacc->base),
- lacc->base, lacc->offset,
- racc, NULL, false);
+ lacc->type = build_aligned_type (racc->type,
+ get_object_alignment
(lacc->expr));
+ lacc->expr = build_ref_for_offset (EXPR_LOCATION (lacc->base),
+ lacc->base, lacc->offset,
+ lacc->type, NULL, false);
lacc->grp_no_warning = true;
}
}
note the build_user_friendly_ref_for_offset which is really bogus as it
would construct component-refs out of thin air. The above probably
completely disables that path ...
get_object_alignment is a little conservative - we can and need to
do better by mimicking what expand does. Note that we can't use
build_ref_for_model here.
With the above the testcase passes as well and we still scalarize:
SR.7_10 = SR.6_11;
c1x128$m_2 = SR.7_10;
c4x32_15 = c1x128$m_2;
MEM[(struct *)&D.1760] = c4x32_15;
More information about the Gcc-bugs
mailing list