From 759bd8b73bcd7a978d63e9193f30cd6c6bdd0b74 Mon Sep 17 00:00:00 2001 From: "J\"orn Rennecke" Date: Tue, 7 Jul 1998 13:09:07 +0000 Subject: [PATCH] * cse (cse_insn): Don't make change without validation. From-SVN: r20996 --- gcc/ChangeLog | 4 ++++ gcc/cse.c | 27 +++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 883e45f4691..716d74054cb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +Tue Jul 7 21:05:25 1998 J"orn Rennecke + + * cse (cse_insn): Don't make change without validation. + Tue Jul 7 11:40:05 1998 Jeffrey A Law (law@cygnus.com) * mn10200.md (various zero/sign extension patterns): zero and sign diff --git a/gcc/cse.c b/gcc/cse.c index fd7b80bd8de..e34908f1680 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)]]; + rtx new_src + = (first >= FIRST_PSEUDO_REGISTER + ? regno_reg_rtx[first] : gen_rtx_REG (GET_MODE (src), first)); - 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; + /* 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. */