public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/12419] New: Performace regression: poor optimization of const memory
@ 2003-09-26 14:55 aph at gcc dot gnu dot org
  2003-09-26 14:56 ` [Bug optimization/12419] " aph at gcc dot gnu dot org
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: aph at gcc dot gnu dot org @ 2003-09-26 14:55 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Performace regression: poor optimization of const memory
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aph at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org

This program:

extern const int a[];
extern void f();

int foo ()
{
  int n = a[0]; 
  f();
  n += a[0];
  return n;
}

generates this code:

foo:
        pushl   %ebx
        subl    $8, %esp
        movl    a, %ebx
        call    f
        movl    a, %eax
        addl    $8, %esp
        addl    %eax, %ebx
        movl    %ebx, %eax
        popl    %ebx
        ret

Note that the memory 'a' is read twice.  3.2 did this:

foo:
        pushl   %ebx
        subl    $8, %esp
        movl    a, %ebx
        sall    $1, %ebx
        call    f
        addl    $8, %esp
        movl    %ebx, %eax
        popl    %ebx
        ret


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

end of thread, other threads:[~2004-09-28 13:56 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-26 14:55 [Bug optimization/12419] New: Performace regression: poor optimization of const memory aph at gcc dot gnu dot org
2003-09-26 14:56 ` [Bug optimization/12419] " aph at gcc dot gnu dot org
2003-09-26 18:35 ` bangerth at dealii dot org
2003-09-27  8:12 ` [Bug optimization/12419] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
2003-09-29 23:07 ` janis187 at us dot ibm dot com
2003-09-29 23:15 ` pinskia at gcc dot gnu dot org
2003-09-30 19:39 ` aph at gcc dot gnu dot org
2003-10-06  8:01 ` bonzini at gnu dot org
2003-12-18 17:39 ` steven at gcc dot gnu dot org
2004-01-04  9:11 ` pinskia at gcc dot gnu dot org
2004-01-04  9:17 ` pinskia at gcc dot gnu dot org
2004-01-12 15:09 ` giovannibajo at libero dot it
2004-01-13 11:46 ` ebotcazou at gcc dot gnu dot org
2004-01-16 17:33 ` aph at gcc dot gnu dot org
2004-01-17  8:51 ` [Bug optimization/12419] [3.3/3.4/3.5 " ebotcazou at gcc dot gnu dot org
2004-03-02  2:22 ` pinskia at gcc dot gnu dot org
2004-03-02 10:03 ` aph at gcc dot gnu dot org
2004-03-02 12:16 ` giovannibajo at libero dot it
2004-04-01 17:02 ` jakub at gcc dot gnu dot org
2004-04-05 15:36 ` jakub at gcc dot gnu dot org
2004-06-11 22:21 ` [Bug rtl-optimization/12419] [3.3 " pinskia at gcc dot gnu dot org
2004-09-06 14:16 ` aph at gcc dot gnu dot org
2004-09-28 13:23 ` gdr at gcc dot gnu dot org
2004-09-28 13:36 ` [Bug rtl-optimization/12419] [3.3 Regression] Performance " jakub at gcc dot gnu dot org
2004-09-28 13:56 ` gdr at cs dot tamu dot edu
2004-09-28 13:57 ` gdr 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).