public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/14060] New: An unused register is saved to the stack.
@ 2004-02-07 6:25 kazu at cs dot umass dot edu
2004-02-07 6:38 ` [Bug middle-end/14060] " kazu at cs dot umass dot edu
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-02-07 6:25 UTC (permalink / raw)
To: gcc-bugs
/* Use ./cc1 -mh -O2 -fomit-frame-pointer. */
extern long bar (long, long *);
void
foo (long z)
{
long a[2];
a[0] = z;
while (1)
{
if (bar (z, a))
return;
}
}
Note that er5 is saved but not used anywhere in the function.
_foo:
mov.l er4,@-er7
mov.l er5,@-er7
subs #4,er7
subs #4,er7
mov.l er0,er4
mov.l er0,@er7
.L2:
mov.l er7,er1
mov.l er4,er0
jsr @_bar
mov.l er0,er0
beq .L2
adds #4,er7
adds #4,er7
mov.l @er7+,er5
mov.l @er7+,er4
rts
--
Summary: An unused register is saved to the stack.
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at cs dot umass dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: h8300-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14060
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/14060] An unused register is saved to the stack.
2004-02-07 6:25 [Bug middle-end/14060] New: An unused register is saved to the stack kazu at cs dot umass dot edu
@ 2004-02-07 6:38 ` kazu at cs dot umass dot edu
2004-02-07 8:39 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-02-07 6:38 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/14060] An unused register is saved to the stack.
2004-02-07 6:25 [Bug middle-end/14060] New: An unused register is saved to the stack kazu at cs dot umass dot edu
2004-02-07 6:38 ` [Bug middle-end/14060] " kazu at cs dot umass dot edu
@ 2004-02-07 8:39 ` pinskia at gcc dot gnu dot org
2004-02-09 17:07 ` kazu at cs dot umass dot edu
2005-02-08 17:10 ` steven at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-07 8:39 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14060
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/14060] An unused register is saved to the stack.
2004-02-07 6:25 [Bug middle-end/14060] New: An unused register is saved to the stack kazu at cs dot umass dot edu
2004-02-07 6:38 ` [Bug middle-end/14060] " kazu at cs dot umass dot edu
2004-02-07 8:39 ` pinskia at gcc dot gnu dot org
@ 2004-02-09 17:07 ` kazu at cs dot umass dot edu
2005-02-08 17:10 ` steven at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-02-09 17:07 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-02-09 17:07:37
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14060
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/14060] An unused register is saved to the stack.
2004-02-07 6:25 [Bug middle-end/14060] New: An unused register is saved to the stack kazu at cs dot umass dot edu
` (2 preceding siblings ...)
2004-02-09 17:07 ` kazu at cs dot umass dot edu
@ 2005-02-08 17:10 ` steven at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-02-08 17:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2005-02-08 10:19 -------
Kazu, is this still a problem?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14060
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-02-08 10:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-07 6:25 [Bug middle-end/14060] New: An unused register is saved to the stack kazu at cs dot umass dot edu
2004-02-07 6:38 ` [Bug middle-end/14060] " kazu at cs dot umass dot edu
2004-02-07 8:39 ` pinskia at gcc dot gnu dot org
2004-02-09 17:07 ` kazu at cs dot umass dot edu
2005-02-08 17:10 ` steven at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).