summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-21 20:03:14 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-21 20:03:14 +0000
commit420c0cf5f44e9eda2e2ffb8c6c14ff69ce394718 (patch)
tree04034272b68fd7bb4a52600de902cf6c0e66ea0c
parentf289122f85543ceda75135120d4bc60d7107021d (diff)
downloadgcc-420c0cf5f44e9eda2e2ffb8c6c14ff69ce394718.tar.gz
fix sched compare regression
for gcc/ChangeLog PR rtl-optimization/64164 PR rtl-optimization/67227 * alias.c (memrefs_conflict_p): Handle VALUEs in PLUS better. (nonoverlapping_memrefs_p): Test offsets and sizes when given identical gimple_reg exprs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227085 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/alias.c23
2 files changed, 30 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 61a3360e20e..11f616a705e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2015-08-21 Alexandre Oliva <aoliva@redhat.com>
+
+ PR rtl-optimization/67227
+ PR rtl-optimization/64164
+ * alias.c (memrefs_conflict_p): Handle VALUEs in PLUS better.
+ (nonoverlapping_memrefs_p): Test offsets and sizes when given
+ identical gimple_reg exprs.
+
2015-08-21 Nathan Sidwell <nathan@acm.org>
* config/nvptx/nvptx.md (allocate_stack): Emit sorry during
diff --git a/gcc/alias.c b/gcc/alias.c
index 4681e3f8b96..f12d9d12a2b 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2228,6 +2228,13 @@ memrefs_conflict_p (int xsize, rtx x, int ysize, rtx y, HOST_WIDE_INT c)
rtx x0 = XEXP (x, 0);
rtx x1 = XEXP (x, 1);
+ /* However, VALUEs might end up in different positions even in
+ canonical PLUSes. Comparing their addresses is enough. */
+ if (x0 == y)
+ return memrefs_conflict_p (xsize, x1, ysize, const0_rtx, c);
+ else if (x1 == y)
+ return memrefs_conflict_p (xsize, x0, ysize, const0_rtx, c);
+
if (GET_CODE (y) == PLUS)
{
/* The fact that Y is canonicalized means that this
@@ -2235,6 +2242,11 @@ memrefs_conflict_p (int xsize, rtx x, int ysize, rtx y, HOST_WIDE_INT c)
rtx y0 = XEXP (y, 0);
rtx y1 = XEXP (y, 1);
+ if (x0 == y1)
+ return memrefs_conflict_p (xsize, x1, ysize, y0, c);
+ if (x1 == y0)
+ return memrefs_conflict_p (xsize, x0, ysize, y1, c);
+
if (rtx_equal_for_memref_p (x1, y1))
return memrefs_conflict_p (xsize, x0, ysize, y0, c);
if (rtx_equal_for_memref_p (x0, y0))
@@ -2263,6 +2275,11 @@ memrefs_conflict_p (int xsize, rtx x, int ysize, rtx y, HOST_WIDE_INT c)
rtx y0 = XEXP (y, 0);
rtx y1 = XEXP (y, 1);
+ if (x == y0)
+ return memrefs_conflict_p (xsize, const0_rtx, ysize, y1, c);
+ if (x == y1)
+ return memrefs_conflict_p (xsize, const0_rtx, ysize, y0, c);
+
if (CONST_INT_P (y1))
return memrefs_conflict_p (xsize, x, ysize, y0, c + INTVAL (y1));
else
@@ -2518,7 +2535,11 @@ nonoverlapping_memrefs_p (const_rtx x, const_rtx y, bool loop_invariant)
able to do anything about them since no SSA information will have
remained to guide it. */
if (is_gimple_reg (exprx) || is_gimple_reg (expry))
- return exprx != expry;
+ return exprx != expry
+ || (moffsetx_known_p && moffsety_known_p
+ && MEM_SIZE_KNOWN_P (x) && MEM_SIZE_KNOWN_P (y)
+ && !offset_overlap_p (moffsety - moffsetx,
+ MEM_SIZE (x), MEM_SIZE (y)));
/* With invalid code we can end up storing into the constant pool.
Bail out to avoid ICEing when creating RTL for this.