aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-im.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-01-30 12:41:13 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-01-30 12:41:13 +0000
commit79977c82ff9ef0a79229a57277feac3cbcc17a83 (patch)
tree689724d088ee83d8265fbd0cf2e7dce51105eeeb /gcc/tree-ssa-loop-im.c
parent8c11f2693e3f55d7fbf37642c3e75d03a9e58013 (diff)
downloadgcc-79977c82ff9ef0a79229a57277feac3cbcc17a83.zip
gcc-79977c82ff9ef0a79229a57277feac3cbcc17a83.tar.gz
gcc-79977c82ff9ef0a79229a57277feac3cbcc17a83.tar.bz2
re PR tree-optimization/89111 (wrong code at -O1 and above on x86_64-linux-gnu)
2019-01-30 Richard Biener <rguenther@suse.de> PR tree-optimization/89111 * tree-ssa-loop-im.c (gather_mem_refs_stmt): Restrict canonicalization to appropriately sized access types. * gcc.dg/torture/pr89111.c: New testcase. From-SVN: r268388
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r--gcc/tree-ssa-loop-im.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index d8a8440..631dd90 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -1472,6 +1472,11 @@ gather_mem_refs_stmt (struct loop *loop, gimple *stmt)
&& aor.max_size.is_constant (&max_size)
&& size == max_size
&& (size % BITS_PER_UNIT) == 0
+ /* We're canonicalizing to a MEM where TYPE_SIZE specifies the
+ size. Make sure this is consistent with the extraction. */
+ && poly_int_tree_p (TYPE_SIZE (TREE_TYPE (*mem)))
+ && known_eq (wi::to_poly_offset (TYPE_SIZE (TREE_TYPE (*mem))),
+ aor.size)
&& (mem_base = get_addr_base_and_unit_offset (aor.ref, &mem_off)))
{
hash = iterative_hash_expr (ao_ref_base (&aor), 0);