This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/14060] An unused register is saved to the stack.


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]