From: Richard Guenther Date: Tue, 28 Feb 2012 09:18:35 +0000 (+0000) Subject: re PR tree-optimization/52395 (Too conservative alignment info from SRA) X-Git-Tag: releases/gcc-4.7.0~178 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=85998a930587e8b03cf19bae41bb198cf82328b8;p=thirdparty%2Fgcc.git re PR tree-optimization/52395 (Too conservative alignment info from SRA) 2012-02-28 Richard Guenther PR tree-optimization/52395 * tree-sra.c (build_ref_for_offset): Also look at the base TYPE_ALIGN when figuring out the alignment of the replacement. From-SVN: r184620 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 24df23ab7deb..155ba4606eac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-02-28 Richard Guenther + + PR tree-optimization/52395 + * tree-sra.c (build_ref_for_offset): Also look at the base + TYPE_ALIGN when figuring out the alignment of the replacement. + 2012-02-28 Richard Guenther PR tree-optimization/52402 diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 1439c43c8896..710f24eeba6b 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1526,10 +1526,12 @@ build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset, we can extract more optimistic alignment information by looking at the access mode. That would constrain the alignment of base + base_offset which we would need to - adjust according to offset. - ??? But it is not at all clear that prev_base is an access - that was in the IL that way, so be conservative for now. */ + adjust according to offset. */ align = get_pointer_alignment_1 (base, &misalign); + if (misalign == 0 + && (TREE_CODE (prev_base) == MEM_REF + || TREE_CODE (prev_base) == TARGET_MEM_REF)) + align = MAX (align, TYPE_ALIGN (TREE_TYPE (prev_base))); misalign += (double_int_sext (tree_to_double_int (off), TYPE_PRECISION (TREE_TYPE (off))).low * BITS_PER_UNIT);