aboutsummaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorJ"orn Rennecke <amylaar@cygnus.co.uk>1998-07-07 13:09:07 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>1998-07-07 14:09:07 +0100
commit759bd8b73bcd7a978d63e9193f30cd6c6bdd0b74 (patch)
tree7cbde0f7b9d0cb95d7da7f00fc04eb7c6049068c /gcc/cse.c
parent8ea2460f6ab25ef4ffad23568ea740f973c7e8b9 (diff)
downloadgcc-759bd8b73bcd7a978d63e9193f30cd6c6bdd0b74.zip
gcc-759bd8b73bcd7a978d63e9193f30cd6c6bdd0b74.tar.gz
gcc-759bd8b73bcd7a978d63e9193f30cd6c6bdd0b74.tar.bz2
* cse (cse_insn): Don't make change without validation.
From-SVN: r20996
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index fd7b80b..e34908f 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7004,17 +7004,24 @@ cse_insn (insn, libcall_insn)
SRC is a hard register. */
{
int first = qty_first_reg[reg_qty[REGNO (src)]];
-
- src = SET_SRC (sets[i].rtl)
- = first >= FIRST_PSEUDO_REGISTER ? regno_reg_rtx[first]
- : gen_rtx_REG (GET_MODE (src), first);
-
- /* If we had a constant that is cheaper than what we are now
- setting SRC to, use that constant. We ignored it when we
- thought we could make this into a no-op. */
- if (src_const && COST (src_const) < COST (src)
- && validate_change (insn, &SET_SRC (sets[i].rtl), src_const, 0))
- src = src_const;
+ rtx new_src
+ = (first >= FIRST_PSEUDO_REGISTER
+ ? regno_reg_rtx[first] : gen_rtx_REG (GET_MODE (src), first));
+
+ /* We must use validate-change even for this, because this
+ might be a special no-op instruction, suitable only to
+ tag notes onto. */
+ if (validate_change (insn, &SET_SRC (sets[i].rtl), new_src, 0))
+ {
+ src = new_src;
+ /* If we had a constant that is cheaper than what we are now
+ setting SRC to, use that constant. We ignored it when we
+ thought we could make this into a no-op. */
+ if (src_const && COST (src_const) < COST (src)
+ && validate_change (insn, &SET_SRC (sets[i].rtl), src_const,
+ 0))
+ src = src_const;
+ }
}
/* If we made a change, recompute SRC values. */