aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcse.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2016-03-01 22:31:52 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2016-03-01 22:31:52 +0000
commit0bca04b822bc5ee0f5bbb2ba5df6669a433d0bf5 (patch)
treece9623d9e599375c8a302640e503ebd518fd6185 /gcc/gcse.c
parent2a9afc868088221a4edd54e79d1388ab25f7f2fa (diff)
downloadgcc-0bca04b822bc5ee0f5bbb2ba5df6669a433d0bf5.zip
gcc-0bca04b822bc5ee0f5bbb2ba5df6669a433d0bf5.tar.gz
gcc-0bca04b822bc5ee0f5bbb2ba5df6669a433d0bf5.tar.bz2
re PR rtl-optimization/70007 (wrong code with -mbmi2)
PR rtl-optimization/70007 * gcse.c (compute_ld_motion_mems): Tidy up and also invalidate memory references present in REG_EQUAL notes attached to non-SET patterns. From-SVN: r233867
Diffstat (limited to 'gcc/gcse.c')
-rw-r--r--gcc/gcse.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 51277a1..a3a7dc3 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -3796,10 +3796,8 @@ compute_ld_motion_mems (void)
{
rtx src = SET_SRC (PATTERN (insn));
rtx dest = SET_DEST (PATTERN (insn));
- rtx note = find_reg_equal_equiv_note (insn);
- rtx src_eq;
- /* Check for a simple LOAD... */
+ /* Check for a simple load. */
if (MEM_P (src) && simple_mem (src))
{
ptr = ldst_entry (src);
@@ -3814,12 +3812,11 @@ compute_ld_motion_mems (void)
invalidate_any_buried_refs (src);
}
- if (note != 0 && REG_NOTE_KIND (note) == REG_EQUAL)
- src_eq = XEXP (note, 0);
- else
- src_eq = NULL_RTX;
-
- if (src_eq != NULL_RTX
+ /* Check for a simple load through a REG_EQUAL note. */
+ rtx note = find_reg_equal_equiv_note (insn), src_eq;
+ if (note
+ && REG_NOTE_KIND (note) == REG_EQUAL
+ && (src_eq = XEXP (note, 0))
&& !(MEM_P (src_eq) && simple_mem (src_eq)))
invalidate_any_buried_refs (src_eq);
@@ -3843,7 +3840,17 @@ compute_ld_motion_mems (void)
}
}
else
- invalidate_any_buried_refs (PATTERN (insn));
+ {
+ /* Invalidate all MEMs in the pattern and... */
+ invalidate_any_buried_refs (PATTERN (insn));
+
+ /* ...in REG_EQUAL notes for PARALLELs with single SET. */
+ rtx note = find_reg_equal_equiv_note (insn), src_eq;
+ if (note
+ && REG_NOTE_KIND (note) == REG_EQUAL
+ && (src_eq = XEXP (note, 0)))
+ invalidate_any_buried_refs (src_eq);
+ }
}
}
}