public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: luke@diamand.org
To: gcc-gnats@gcc.gnu.org
Subject: target/9841: ARM - appears to always save LR on stack, even with -fomit-frame-pointer
Date: Mon, 24 Feb 2003 21:46:00 -0000	[thread overview]
Message-ID: <20030224214543.2616.qmail@sources.redhat.com> (raw)


>Number:         9841
>Category:       target
>Synopsis:       ARM - appears to always save LR on stack, even with -fomit-frame-pointer
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 24 21:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     luke@diamand.org
>Release:        3.2.2
>Organization:
>Environment:
Linux x86 host
arm-elf target
>Description:
ARM/gcc3.2.2 always appears to save LR on the stack, even when not needed, and regarldess of -fomit-frame-pointer.

>How-To-Repeat:

I seem unable to get -fomit-frame-pointer to do anything on
ARM/gcc3.2.2.

With gcc2.95.2, configured for ARM/AOUT, compiling the following function:

void test(char *buf) {
    my_strcpy(buf,"HELLO");
}

with:
% gcc -S -O2 -fomit-frame-pointer -mapcs-32 foo.c

I would get:

_test:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, current_function_anonymous_args = 0
        @ I don't think this function clobbers lr
        ldr     r1, L3
        b       _my_strcpy

Now the same code, with gcc3.2.2 (configured for ELF this time but I can't see why that should change things) I get:

test:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 0, uses_anonymous_args = 0
        str     lr, [sp, #-4]!
        ldr     r1, .L2
        @ Sibcall epilogue
        ldr     lr, [sp], #4
        b       my_strcpy

So, the compiler carefully stores lr on the stack, for no good reason as far as I can tell (I have no interest in debugging this code, hence the -fomit-frame-pointer). I can't find any combination of options that will make this compile properly (-mapcs-frame, -mapcs-32).

Looking at the code in gcc/config/arm/arm.c, and comparing releases, it looks as though the code for this optimization has been lost.

This adds quite significantly to code size, and probably slows things down as well.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-02-24 21:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-24 21:46 luke [this message]
2003-02-26 17:56 rearnsha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030224214543.2616.qmail@sources.redhat.com \
    --to=luke@diamand.org \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).