aboutsummaryrefslogtreecommitdiff
path: root/gcc/dse.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-01-26 14:50:25 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-01-26 14:50:25 +0000
commitd7e1f499ed046bd1d57eaf4510778d2fc2666653 (patch)
treeaf94a9ed7de3029422c43104fa59e8e934539808 /gcc/dse.c
parentda1f8d7f12c2efeadb3b127f6274fd0424c32410 (diff)
downloadgcc-d7e1f499ed046bd1d57eaf4510778d2fc2666653.zip
gcc-d7e1f499ed046bd1d57eaf4510778d2fc2666653.tar.gz
gcc-d7e1f499ed046bd1d57eaf4510778d2fc2666653.tar.bz2
re PR rtl-optimization/84003 (FAIL: g++.dg/torture/pr77745.C with noinline foo)
2018-01-26 Richard Biener <rguenther@suse.de> PR rtl-optimization/84003 * dse.c (record_store): Only record redundant stores when the earlier store aliases at least all accesses the later one does. * g++.dg/torture/pr77745.C: Mark foo noinline to trigger latent bug in DSE if NOINLINE is appropriately defined. * g++.dg/torture/pr77745-2.C: New testcase including pr77745.C and defining NOINLINE. From-SVN: r257091
Diffstat (limited to 'gcc/dse.c')
-rw-r--r--gcc/dse.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/dse.c b/gcc/dse.c
index a0c66aa..1ef8f64 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -1532,7 +1532,12 @@ record_store (rtx body, bb_info_t bb_info)
&& known_subrange_p (offset, width,
s_info->offset, s_info->width)
&& all_positions_needed_p (s_info, offset - s_info->offset,
- width))
+ width)
+ /* We can only remove the later store if the earlier aliases
+ at least all accesses the later one. */
+ && (MEM_ALIAS_SET (mem) == MEM_ALIAS_SET (s_info->mem)
+ || alias_set_subset_of (MEM_ALIAS_SET (mem),
+ MEM_ALIAS_SET (s_info->mem))))
{
if (GET_MODE (mem) == BLKmode)
{