From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9135 invoked by alias); 7 Feb 2004 06:38:39 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 9119 invoked by uid 48); 7 Feb 2004 06:38:39 -0000 Date: Sat, 07 Feb 2004 06:38:00 -0000 Message-ID: <20040207063839.9118.qmail@sources.redhat.com> From: "kazu at cs dot umass dot edu" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040207062512.14060.kazu@cs.umass.edu> References: <20040207062512.14060.kazu@cs.umass.edu> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug middle-end/14060] An unused register is saved to the stack. X-Bugzilla-Reason: CC X-SW-Source: 2004-02/txt/msg00856.txt.bz2 List-Id: ------- Additional Comments From kazu at cs dot umass dot edu 2004-02-07 06:38 ------- My guess is as follows: Before the register allocation, we have this. (insn 46 10 12 0 (set (reg/f:SI 20) (plus:SI (reg/f:SI 11 fp) (const_int -8 [0xfffffff8]))) 36 {*addsi_h8300hs} (nil) (nil)) There is no matching constraint for this insn (because H8 is a two-address machine). So the source is spilled. But it turns out that (plus (reg:SI 11) (const_int -8)) is equal to (reg:SI sp). So an addition instruction becomes a move instruction: (set (reg:SI 20) (reg:SI sp)) But the reload or the register allocator doesn't go back and say that the spill made above is not necessary anymore. Before this patch http://gcc.gnu.org/ml/gcc-patches/2004-01/msg03252.html I used to see a use of er5 (although a stupid one). eliminate_regs_in_insn() is called too late to notice that the spill is not needed. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14060