aboutsummaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel1@de.ibm.com>2008-02-25 15:07:17 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2008-02-25 15:07:17 +0000
commit2e4e39f615dacf0dbc8b02db27b1046f849c731d (patch)
treefc21b35d3970def7cfb0d7c5ee657f66f97bd3bf /gcc/cse.c
parent891984af0ffaed847d07a43c5528e9bd217dc2b9 (diff)
downloadgcc-2e4e39f615dacf0dbc8b02db27b1046f849c731d.zip
gcc-2e4e39f615dacf0dbc8b02db27b1046f849c731d.tar.gz
gcc-2e4e39f615dacf0dbc8b02db27b1046f849c731d.tar.bz2
re PR target/35258 (two memcpy calls merged incorrectly with -O1)
2008-02-25 Andreas Krebbel <krebbel1@de.ibm.com> PR target/35258 * cse.c (cse_insn): Avoid creation of overlapping MEMs. * alias.c (nonoverlapping_memrefs_p): Export for use in other modules. * alias.h (nonoverlapping_memrefs_p): Likewise. 2008-02-25 Andreas Krebbel <krebbel1@de.ibm.com> PR target/35258 * gcc.dg/pr35258.c: New testcase. From-SVN: r132628
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index f6660e4..9f31e67 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -4753,6 +4753,23 @@ cse_insn (rtx insn, rtx libcall_insn)
src_elt_cost = MAX_COST;
}
+ /* Avoid creation of overlapping memory moves. */
+ if (MEM_P (trial) && MEM_P (SET_DEST (sets[i].rtl)))
+ {
+ rtx src, dest;
+
+ /* BLKmode moves are not handled by cse anyway. */
+ if (GET_MODE (trial) == BLKmode)
+ break;
+
+ src = canon_rtx (trial);
+ dest = canon_rtx (SET_DEST (sets[i].rtl));
+
+ if (!MEM_P (src) || !MEM_P (dest)
+ || !nonoverlapping_memrefs_p (src, dest))
+ break;
+ }
+
/* We don't normally have an insn matching (set (pc) (pc)), so
check for this separately here. We will delete such an
insn below.