From 62874575d9628c6e7b3bf072ca754c74b64fd3a0 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Thu, 14 Jul 1994 09:42:18 -0400 Subject: [PATCH] (force_reg): Don't make a REG_EQUAL note for an insn that doesn't set TEMP. From-SVN: r7771 --- gcc/explow.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gcc/explow.c b/gcc/explow.c index 1c94b816c19..b72e468e050 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -578,15 +578,19 @@ force_reg (mode, x) enum machine_mode mode; rtx x; { - register rtx temp, insn; + register rtx temp, insn, set; if (GET_CODE (x) == REG) return x; temp = gen_reg_rtx (mode); insn = emit_move_insn (temp, x); + /* Let optimizers know that TEMP's value never changes - and that X can be substituted for it. */ - if (CONSTANT_P (x)) + and that X can be substituted for it. Don't get confused + if INSN set something else (such as a SUBREG of TEMP). */ + if (CONSTANT_P (x) + && (set = single_set (insn)) != 0 + && SET_DEST (set) == temp) { rtx note = find_reg_note (insn, REG_EQUAL, NULL_RTX); -- 2.30.2