public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/14151] New: new-ra get frame size incorrect
@ 2004-02-15 18:37 andrewhutchinson at cox dot net
  2004-02-15 18:45 ` [Bug optimization/14151] [new-ra] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: andrewhutchinson at cox dot net @ 2004-02-15 18:37 UTC (permalink / raw)
  To: gcc-bugs

new-ra gives substantial code size and speed improvments on avr target.
However, gain is lost because the frame size is wrong. Or more precisely the
frame size reflects the inclusion of stack slots that have been optimised away.

Code below show a simple case where frame size is 2 - presumably reflecting the
"i" local variable that is in a register.

Without -fnew-ra, the epilog/prolog is empty (ie frame pointer can be eliminated)

I have managed to determine that the AVR target is being told that the frame
size is 2.

int CallbackFunc[10];
void Timer0_Init(void)
{
    //mt char i;
	char i;

    // Initialize array of callback functions
    for (i=0; i<10; i++)
        CallbackFunc[i] = 0;

}





compiler options (GCC 3.3.1 target AVR). Host win2k and XP

-Os -W -Wall -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums  


WITHOUT -new-ra we get no frame (since it get optimized away)

    .file   "testcase.c"
    .arch avr2
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
    .global __do_copy_data
    .global __do_clear_bss
    .text
.global Timer0_Init
    .type   Timer0_Init, @function
Timer0_Init:
/* prologue: frame size=0 */
/* prologue end (size=0) */
    ldi r24,lo8(0)
    ldi r30,lo8(CallbackFunc)
    ldi r31,hi8(CallbackFunc)
.L6:
    st Z+,__zero_reg__
    st Z+,__zero_reg__
    subi r24,lo8(-(1))
    cpi r24,lo8(10)
    brlo .L6
/* epilogue: frame size=0 */
    ret
/* epilogue end (size=1) */
/* function Timer0_Init size 9 (8) */
    .size   Timer0_Init, .-Timer0_Init
    .comm CallbackFunc,20,1
/* File "testcase.c": code    9 = 0x0009 (   8), prologues   0, epilogues   1 */


NOW WITH -new-ra we get:
========================

    .file   "testcase.c"
    .arch avr2
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
    .global __do_copy_data
    .global __do_clear_bss
    .text
.global Timer0_Init
    .type   Timer0_Init, @function
Timer0_Init:
/* prologue: frame size=2 */<============================
    push r28<========================================
    push r29<========================================
    in r28,__SP_L__
    in r29,__SP_H__
    sbiw r28,2
    in __tmp_reg__,__SREG__
    cli
    out __SP_H__,r29
    out __SREG__,__tmp_reg__
    out __SP_L__,r28
/* prologue end (size=10) */
    ldi r24,lo8(0)
    ldi r30,lo8(CallbackFunc)
    ldi r31,hi8(CallbackFunc)
.L6:
    st Z+,__zero_reg__
    st Z+,__zero_reg__
    subi r24,lo8(-(1))
    cpi r24,lo8(10)
    brlo .L6
/* epilogue: frame size=2 */
    adiw r28,2
    in __tmp_reg__,__SREG__
    cli
    out __SP_H__,r29
    out __SREG__,__tmp_reg__
    out __SP_L__,r28
    pop r29
    pop r28
    ret
/* epilogue end (size=9) */
/* function Timer0_Init size 27 (8) */
    .size   Timer0_Init, .-Timer0_Init
    .comm CallbackFunc,20,1
/* File "testcase.c": code   27 = 0x001b (   8), prologues  10, epilogues   9 */



__________________________________________________________________

-- 
           Summary: new-ra get frame size incorrect
           Product: gcc
           Version: new-ra
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andrewhutchinson at cox dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: 3.3.1
GCC target triplet: avr


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14151


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug optimization/14151] [new-ra] new-ra get frame size incorrect
  2004-02-15 18:37 [Bug c/14151] New: new-ra get frame size incorrect andrewhutchinson at cox dot net
@ 2004-02-15 18:45 ` pinskia at gcc dot gnu dot org
  2004-02-15 18:46 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-15 18:45 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |matz at suse dot de
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
          Component|c                           |optimization
     Ever Confirmed|                            |1
           Keywords|                            |pessimizes-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-02-15 18:45:32
               date|                            |
            Summary|new-ra get frame size       |[new-ra] new-ra get frame
                   |incorrect                   |size incorrect
            Version|new-ra                      |3.3.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14151


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug optimization/14151] [new-ra] new-ra get frame size incorrect
  2004-02-15 18:37 [Bug c/14151] New: new-ra get frame size incorrect andrewhutchinson at cox dot net
  2004-02-15 18:45 ` [Bug optimization/14151] [new-ra] " pinskia at gcc dot gnu dot org
@ 2004-02-15 18:46 ` pinskia at gcc dot gnu dot org
  2004-04-08 21:03 ` 1319 at bot dot ru
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-15 18:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-15 18:46 -------
Suspending until either new-regalloc branch is merged to mainline, or bug is rechecked against 
new-regalloc branch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |13246
              nThis|                            |
             Status|ASSIGNED                    |SUSPENDED
  GCC build triplet|3.3.1                       |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14151


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug optimization/14151] [new-ra] new-ra get frame size incorrect
  2004-02-15 18:37 [Bug c/14151] New: new-ra get frame size incorrect andrewhutchinson at cox dot net
  2004-02-15 18:45 ` [Bug optimization/14151] [new-ra] " pinskia at gcc dot gnu dot org
  2004-02-15 18:46 ` pinskia at gcc dot gnu dot org
@ 2004-04-08 21:03 ` 1319 at bot dot ru
  2004-08-12  1:51 ` [Bug rtl-optimization/14151] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: 1319 at bot dot ru @ 2004-04-08 21:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From 1319 at bot dot ru  2004-04-08 21:03 -------
new-regalloc branch fails to compile testcase:

$ ./xgcc -B. -S ~/tmp/14151.c 
/home/ssb/tmp/14151.c: In function `Timer0_Init':

/home/ssb/tmp/14151.c:11: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
$

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14151


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/14151] [new-ra] new-ra get frame size incorrect
  2004-02-15 18:37 [Bug c/14151] New: new-ra get frame size incorrect andrewhutchinson at cox dot net
                   ` (2 preceding siblings ...)
  2004-04-08 21:03 ` 1319 at bot dot ru
@ 2004-08-12  1:51 ` pinskia at gcc dot gnu dot org
  2004-12-25  2:34 ` andrewhutchinson at cox dot net
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-12  1:51 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |16996
              nThis|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14151


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/14151] [new-ra] new-ra get frame size incorrect
  2004-02-15 18:37 [Bug c/14151] New: new-ra get frame size incorrect andrewhutchinson at cox dot net
                   ` (3 preceding siblings ...)
  2004-08-12  1:51 ` [Bug rtl-optimization/14151] " pinskia at gcc dot gnu dot org
@ 2004-12-25  2:34 ` andrewhutchinson at cox dot net
  2004-12-25 10:21 ` steven at gcc dot gnu dot org
  2005-01-17 15:25 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: andrewhutchinson at cox dot net @ 2004-12-25  2:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From andrewhutchinson at cox dot net  2004-12-25 02:33 -------
Problem still present on gcc (GCC) 4.0.0 20041205 (experimental) SNAPSHOT *sigh*

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14151


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/14151] [new-ra] new-ra get frame size incorrect
  2004-02-15 18:37 [Bug c/14151] New: new-ra get frame size incorrect andrewhutchinson at cox dot net
                   ` (4 preceding siblings ...)
  2004-12-25  2:34 ` andrewhutchinson at cox dot net
@ 2004-12-25 10:21 ` steven at gcc dot gnu dot org
  2005-01-17 15:25 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-25 10:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-12-25 10:20 -------
Andy, I think you should know this probably won't be fixed :-(  It is more
likely at this point that the whole new register allocator will be removed
as a failed experiment.  This is also why the bug status is SUSPENDED: It
will be closed as WONTFIX once it is decided for sure that new-ra is to be
removed from gcc.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14151


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/14151] [new-ra] new-ra get frame size incorrect
  2004-02-15 18:37 [Bug c/14151] New: new-ra get frame size incorrect andrewhutchinson at cox dot net
                   ` (5 preceding siblings ...)
  2004-12-25 10:21 ` steven at gcc dot gnu dot org
@ 2005-01-17 15:25 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-17 15:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-17 15:22 -------
Closing as wiill not fix as new-ra was removed from the mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |RESOLVED
         Resolution|                            |WONTFIX
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14151


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-01-17 15:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-15 18:37 [Bug c/14151] New: new-ra get frame size incorrect andrewhutchinson at cox dot net
2004-02-15 18:45 ` [Bug optimization/14151] [new-ra] " pinskia at gcc dot gnu dot org
2004-02-15 18:46 ` pinskia at gcc dot gnu dot org
2004-04-08 21:03 ` 1319 at bot dot ru
2004-08-12  1:51 ` [Bug rtl-optimization/14151] " pinskia at gcc dot gnu dot org
2004-12-25  2:34 ` andrewhutchinson at cox dot net
2004-12-25 10:21 ` steven at gcc dot gnu dot org
2005-01-17 15:25 ` pinskia 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).