public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/32603]  New: Sibcall optimization fails to detect non-overlapping arguments
@ 2007-07-02 23:27 jconner at apple dot com
  2007-07-02 23:29 ` [Bug middle-end/32603] " jconner at apple dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jconner at apple dot com @ 2007-07-02 23:27 UTC (permalink / raw)
  To: gcc-bugs

The following code, compiled for arm-none-elf at -O2:

~~~~~~~~~~

#define noinline __attribute__((noinline))

typedef struct {
  int data[4];
} arr16_t;

int result = 0;

void noinline func2 (int i, int j, arr16_t arr)
{
  result = (arr.data[0] != 1
            || arr.data[1] != 2
            || arr.data[2] != 3
            || arr.data[3] != 4);
}

void func1 (int i, int j, int k, int l, int m, int n, arr16_t a)
{
  func2(i, j, a);
}

int main(int argc, const char *argv[])
{
  arr16_t arr = {{1, 2, 3, 4}};

  func1(0, 0, 0, 0, 0, 0, arr);
  return result;
}

~~~~~~~~~~

The call to func2 should be optimized into a sibcall, however store_one_arg()
is preventing it because it incorrectly identifies the arr16_t coming into
func1 as overlapping on the stack where it needs to put the outgoing arr16_t
for the call to func2.  In fact, the incoming arg only uses [SP,SP+7] (the
other two words are passed in registers) and the outgoing arg uses
[SP+8,SP+23].


-- 
           Summary: Sibcall optimization fails to detect non-overlapping
                    arguments
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jconner at apple dot com


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


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

* [Bug middle-end/32603] Sibcall optimization fails to detect non-overlapping arguments
  2007-07-02 23:27 [Bug middle-end/32603] New: Sibcall optimization fails to detect non-overlapping arguments jconner at apple dot com
@ 2007-07-02 23:29 ` jconner at apple dot com
  2007-07-06 16:57 ` jconner at gcc dot gnu dot org
  2009-01-01  5:54 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jconner at apple dot com @ 2007-07-02 23:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jconner at apple dot com  2007-07-02 23:28 -------
I have a patch which addresses this (and pr32602) -- I will submit it shortly.


-- 

jconner at apple dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jconner at apple dot com


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


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

* [Bug middle-end/32603] Sibcall optimization fails to detect non-overlapping arguments
  2007-07-02 23:27 [Bug middle-end/32603] New: Sibcall optimization fails to detect non-overlapping arguments jconner at apple dot com
  2007-07-02 23:29 ` [Bug middle-end/32603] " jconner at apple dot com
@ 2007-07-06 16:57 ` jconner at gcc dot gnu dot org
  2009-01-01  5:54 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jconner at gcc dot gnu dot org @ 2007-07-06 16:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jconner at gcc dot gnu dot org  2007-07-06 16:57 -------
Subject: Bug 32603

Author: jconner
Date: Fri Jul  6 16:57:19 2007
New Revision: 126422

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126422
Log:
2007-07-06  Josh Conner  <jconner@apple.com>

        PR middle-end/32602
        PR middle-end/32603
        * calls.c (store_one_arg): Handle arguments which are partially
        on the stack when detecting argument overlap.

2007-07-06  Josh Conner  <jconner@apple.com>

        PR middle-end/32602
        * gcc.dg/sibcall-8.c: New test.

2007-07-06  Josh Conner  <jconner@apple.com>

        PR middle-end/32603
        * gcc.target/arm/sibcall-1.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/sibcall-8.c
    trunk/gcc/testsuite/gcc.target/arm/sibcall-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/calls.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/32603] Sibcall optimization fails to detect non-overlapping arguments
  2007-07-02 23:27 [Bug middle-end/32603] New: Sibcall optimization fails to detect non-overlapping arguments jconner at apple dot com
  2007-07-02 23:29 ` [Bug middle-end/32603] " jconner at apple dot com
  2007-07-06 16:57 ` jconner at gcc dot gnu dot org
@ 2009-01-01  5:54 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-01  5:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-01-01 05:52 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2009-01-01  5:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-02 23:27 [Bug middle-end/32603] New: Sibcall optimization fails to detect non-overlapping arguments jconner at apple dot com
2007-07-02 23:29 ` [Bug middle-end/32603] " jconner at apple dot com
2007-07-06 16:57 ` jconner at gcc dot gnu dot org
2009-01-01  5:54 ` 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).