aboutsummaryrefslogtreecommitdiff
path: root/gcc/postreload-gcse.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/postreload-gcse.c')
-rw-r--r--gcc/postreload-gcse.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
index a0334ab8077..ea9c0ef7436 100644
--- a/gcc/postreload-gcse.c
+++ b/gcc/postreload-gcse.c
@@ -745,6 +745,12 @@ hash_scan_set (rtx insn)
can_copy_p (GET_MODE (dest))
/* Is SET_SRC something we want to gcse? */
&& general_operand (src, GET_MODE (src))
+#ifdef STACK_REGS
+ /* Never consider insns touching the register stack. It may
+ create situations that reg-stack cannot handle (e.g. a stack
+ register live across an abnormal edge). */
+ && (REGNO (dest) < FIRST_STACK_REG || REGNO (dest) > LAST_STACK_REG)
+#endif
/* An expression is not available if its operands are
subsequently modified, including this insn. */
&& oprs_unchanged_p (src, insn, true))
@@ -759,6 +765,10 @@ hash_scan_set (rtx insn)
can_copy_p (GET_MODE (src))
/* Is SET_DEST something we want to gcse? */
&& general_operand (dest, GET_MODE (dest))
+#ifdef STACK_REGS
+ /* As above for STACK_REGS. */
+ && (REGNO (src) < FIRST_STACK_REG || REGNO (src) > LAST_STACK_REG)
+#endif
&& ! (flag_float_store && FLOAT_MODE_P (GET_MODE (dest)))
/* Check if the memory expression is killed after insn. */
&& ! load_killed_in_block_p (INSN_CUID (insn) + 1, dest, true)