aboutsummaryrefslogtreecommitdiff
path: root/gcc/emit-rtl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-10-09 10:17:08 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-10-09 10:17:08 +0200
commitdf96b059470a8ede40342b4b19c6da1a82851aaf (patch)
tree4b26de45565f6554ef5ed3f5f27def80b657ef53 /gcc/emit-rtl.c
parentcc2a64dd80513c1155fad3370bc639daa97b7404 (diff)
downloadgcc-df96b059470a8ede40342b4b19c6da1a82851aaf.zip
gcc-df96b059470a8ede40342b4b19c6da1a82851aaf.tar.gz
gcc-df96b059470a8ede40342b4b19c6da1a82851aaf.tar.bz2
re PR middle-end/37774 (Alignment information is lost for ARRAY_REFs)
PR middle-end/37774 * tree.h (get_object_alignment): Declare. * emit-rtl.c (set_mem_attributes_minus_bitpos): Call get_object_alignment if needed. * builtins.c (get_pointer_alignment): Move ADDR_EXPR operand handling to ... (get_object_alignment): ... here. New function. Try harder to determine alignment from get_inner_reference returned offset. From-SVN: r141003
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r--gcc/emit-rtl.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 318ae77..4564a0b 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1564,6 +1564,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
if (! TYPE_P (t))
{
tree base;
+ bool align_computed = false;
if (TREE_THIS_VOLATILE (t))
MEM_VOLATILE_P (ref) = 1;
@@ -1620,6 +1621,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
&& host_integerp (DECL_SIZE_UNIT (t), 1)
? GEN_INT (tree_low_cst (DECL_SIZE_UNIT (t), 1)) : 0);
align = DECL_ALIGN (t);
+ align_computed = true;
}
/* If this is a constant, we know the alignment. */
@@ -1629,6 +1631,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
#ifdef CONSTANT_ALIGNMENT
align = CONSTANT_ALIGNMENT (t, align);
#endif
+ align_computed = true;
}
/* If this is a field reference and not a bit-field, record it. */
@@ -1688,6 +1691,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
align = DECL_ALIGN (t2);
if (aoff && (unsigned HOST_WIDE_INT) aoff < align)
align = aoff;
+ align_computed = true;
offset = GEN_INT (ioff);
apply_bitpos = bitpos;
}
@@ -1721,6 +1725,13 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
expr = t;
offset = NULL;
}
+
+ if (!align_computed && !INDIRECT_REF_P (t))
+ {
+ unsigned int obj_align
+ = get_object_alignment (t, align, BIGGEST_ALIGNMENT);
+ align = MAX (align, obj_align);
+ }
}
/* If we modified OFFSET based on T, then subtract the outstanding