aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-sra.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-02-28 09:18:35 +0000
committerRichard Guenther <rguenther@suse.de>2012-02-28 09:18:35 +0000
commit4b2e559849a0221ab00d74abf00f66e0550b9c18 (patch)
treea9d21a45612ee50fadb48bf21238faf85aacf741 /gcc/tree-sra.c
parentf6f96bd610e71738454eef0e13e43c1aa9f158c2 (diff)
2012-02-28 Richard Guenther <rguenther@suse.de>
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@184620 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r--gcc/tree-sra.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 1439c43c889..710f24eeba6 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);