public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/30075]  New: Missed optimizations with -fwhole-program -combine
@ 2006-12-05 18:43 ajax at redhat dot com
  2006-12-05 18:47 ` [Bug middle-end/30075] Missed optimizations with static variable and static function pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: ajax at redhat dot com @ 2006-12-05 18:43 UTC (permalink / raw)
  To: gcc-bugs

---
atropine:~/combine-bug% cat foo.c
int foo(void) {
    return 0;
}

atropine:~/combine-bug% cat bar.c 
extern int foo(void);

void *array[] = {
    foo
};

atropine:~/combine-bug% gcc -shared -fPIC -combine -fwhole-program -o libfoo.so
foo.c bar.c
atropine:~/combine-bug% nm libfoo.so | egrep '(foo)|(array)'
000000000000048c t foo
atropine:~/combine-bug% rpm -q gcc
gcc-4.1.1-30
---

foo is still emitted, when you'd think you could garbage-collect it, since the
array that references it has fallen out of existance.  If you use
-fvisibility=hidden instead of -fwhole-program the result is even worse, both
foo and array are emitted even though the resulting DSO does not give any
access to them.


-- 
           Summary: Missed optimizations with -fwhole-program -combine
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ajax at redhat dot com


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


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

* [Bug middle-end/30075] Missed optimizations with static variable and static function
  2006-12-05 18:43 [Bug c/30075] New: Missed optimizations with -fwhole-program -combine ajax at redhat dot com
@ 2006-12-05 18:47 ` pinskia at gcc dot gnu dot org
  2006-12-05 19:37 ` [Bug c/30075] Missed optimizations with -fwhole-program -combine ajax at redhat dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-05 18:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-12-05 18:46 -------
> If you use -fvisibility=hidden instead of -fwhole-program the result is even
> worse, both foo and array are emitted even though the resulting DSO does not
> give any access to them.

Well that is not GCC's fault really, you should use -ffunction-sections
-Wl,--gc-sections for that


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Missed optimizations with - |Missed optimizations with
                   |fwhole-program -combine     |static variable and static
                   |                            |function


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


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

* [Bug c/30075] Missed optimizations with -fwhole-program -combine
  2006-12-05 18:43 [Bug c/30075] New: Missed optimizations with -fwhole-program -combine ajax at redhat dot com
  2006-12-05 18:47 ` [Bug middle-end/30075] Missed optimizations with static variable and static function pinskia at gcc dot gnu dot org
@ 2006-12-05 19:37 ` ajax at redhat dot com
  2006-12-05 19:39 ` [Bug middle-end/30075] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: ajax at redhat dot com @ 2006-12-05 19:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ajax at redhat dot com  2006-12-05 19:37 -------
Just to clarify, I neglected to use -O in the example above, but this behaviour
is still seen even with -O.


-- 

ajax at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |c


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


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

* [Bug middle-end/30075] Missed optimizations with -fwhole-program -combine
  2006-12-05 18:43 [Bug c/30075] New: Missed optimizations with -fwhole-program -combine ajax at redhat dot com
  2006-12-05 18:47 ` [Bug middle-end/30075] Missed optimizations with static variable and static function pinskia at gcc dot gnu dot org
  2006-12-05 19:37 ` [Bug c/30075] Missed optimizations with -fwhole-program -combine ajax at redhat dot com
@ 2006-12-05 19:39 ` pinskia at gcc dot gnu dot org
  2006-12-06  2:55   ` Daniel Berlin
  2006-12-06  2:55 ` dberlin at dberlin dot org
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-05 19:39 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
          Component|c                           |middle-end


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


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

* Re: [Bug middle-end/30075] Missed optimizations with -fwhole-program -combine
  2006-12-05 19:39 ` [Bug middle-end/30075] " pinskia at gcc dot gnu dot org
@ 2006-12-06  2:55   ` Daniel Berlin
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Berlin @ 2006-12-06  2:55 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

I would not expect this to be fixed anytime soon.  I have yet to find
any real people who use either combine or -fwhole-program.  They use
*way* too much memory on real programs.  As a result, no real people
involved in optimization work on optimizers for them.

On 5 Dec 2006 19:38:51 -0000, pinskia at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> --
>


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

* [Bug middle-end/30075] Missed optimizations with -fwhole-program -combine
  2006-12-05 18:43 [Bug c/30075] New: Missed optimizations with -fwhole-program -combine ajax at redhat dot com
                   ` (2 preceding siblings ...)
  2006-12-05 19:39 ` [Bug middle-end/30075] " pinskia at gcc dot gnu dot org
@ 2006-12-06  2:55 ` dberlin at dberlin dot org
  2007-06-26  3:10 ` acahalan at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: dberlin at dberlin dot org @ 2006-12-06  2:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dberlin at gcc dot gnu dot org  2006-12-06 02:55 -------
Subject: Re:  Missed optimizations with -fwhole-program -combine

I would not expect this to be fixed anytime soon.  I have yet to find
any real people who use either combine or -fwhole-program.  They use
*way* too much memory on real programs.  As a result, no real people
involved in optimization work on optimizers for them.

On 5 Dec 2006 19:38:51 -0000, pinskia at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> --
>


-- 


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


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

* [Bug middle-end/30075] Missed optimizations with -fwhole-program -combine
  2006-12-05 18:43 [Bug c/30075] New: Missed optimizations with -fwhole-program -combine ajax at redhat dot com
                   ` (3 preceding siblings ...)
  2006-12-06  2:55 ` dberlin at dberlin dot org
@ 2007-06-26  3:10 ` acahalan at gmail dot com
  2007-06-26 15:29   ` Daniel Berlin
  2007-06-26 15:29 ` dberlin at dberlin dot org
  2010-09-17  9:09 ` rguenth at gcc dot gnu dot org
  6 siblings, 1 reply; 10+ messages in thread
From: acahalan at gmail dot com @ 2007-06-26  3:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from acahalan at gmail dot com  2007-06-26 03:10 -------
(In reply to comment #3)
> Subject: Re:  Missed optimizations with -fwhole-program -combine
> 
> I would not expect this to be fixed anytime soon.  I have yet to find
> any real people who use either combine or -fwhole-program.  They use
> *way* too much memory on real programs.  As a result, no real people
> involved in optimization work on optimizers for them.

I'm real, and I want to use those.

I can't use them because of bug #29171. They appear to be 100% unusable for
non-trivial programs because gcc WILL emit calls to memcpy and there isn't any
possible (documented at least) way to provide a memcpy. No matter how I
__attribute__ my memcpy, and no matter if I use -ffreestanding or not, gcc
wants to call an extern memcpy. Linking against a libc is against the
documented requirements for using these options.


-- 

acahalan at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |acahalan at gmail dot com


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


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

* [Bug middle-end/30075] Missed optimizations with -fwhole-program -combine
  2006-12-05 18:43 [Bug c/30075] New: Missed optimizations with -fwhole-program -combine ajax at redhat dot com
                   ` (4 preceding siblings ...)
  2007-06-26  3:10 ` acahalan at gmail dot com
@ 2007-06-26 15:29 ` dberlin at dberlin dot org
  2010-09-17  9:09 ` rguenth at gcc dot gnu dot org
  6 siblings, 0 replies; 10+ messages in thread
From: dberlin at dberlin dot org @ 2007-06-26 15:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dberlin at gcc dot gnu dot org  2007-06-26 15:29 -------
Subject: Re:  Missed optimizations with -fwhole-program -combine

On 26 Jun 2007 03:10:26 -0000, acahalan at gmail dot com
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #4 from acahalan at gmail dot com  2007-06-26 03:10 -------
> (In reply to comment #3)
> > Subject: Re:  Missed optimizations with -fwhole-program -combine
> >
> > I would not expect this to be fixed anytime soon.  I have yet to find
> > any real people who use either combine or -fwhole-program.  They use
> > *way* too much memory on real programs.  As a result, no real people
> > involved in optimization work on optimizers for them.
>
> I'm real, and I want to use those.
>

That's nice and all, but i still wouldn't expect any work on them
until LTO is finished.
They are useless options right now.
I'd vote to remove them.


-- 


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


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

* Re: [Bug middle-end/30075] Missed optimizations with -fwhole-program -combine
  2007-06-26  3:10 ` acahalan at gmail dot com
@ 2007-06-26 15:29   ` Daniel Berlin
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Berlin @ 2007-06-26 15:29 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

On 26 Jun 2007 03:10:26 -0000, acahalan at gmail dot com
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #4 from acahalan at gmail dot com  2007-06-26 03:10 -------
> (In reply to comment #3)
> > Subject: Re:  Missed optimizations with -fwhole-program -combine
> >
> > I would not expect this to be fixed anytime soon.  I have yet to find
> > any real people who use either combine or -fwhole-program.  They use
> > *way* too much memory on real programs.  As a result, no real people
> > involved in optimization work on optimizers for them.
>
> I'm real, and I want to use those.
>

That's nice and all, but i still wouldn't expect any work on them
until LTO is finished.
They are useless options right now.
I'd vote to remove them.


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

* [Bug middle-end/30075] Missed optimizations with -fwhole-program -combine
  2006-12-05 18:43 [Bug c/30075] New: Missed optimizations with -fwhole-program -combine ajax at redhat dot com
                   ` (5 preceding siblings ...)
  2007-06-26 15:29 ` dberlin at dberlin dot org
@ 2010-09-17  9:09 ` rguenth at gcc dot gnu dot org
  6 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-09-17  9:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2010-09-17 09:06 -------
-combine has been removed from GCC 4.6 in favor of LTO, closing as WONTFIX.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WONTFIX


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


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

end of thread, other threads:[~2010-09-17  9:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-05 18:43 [Bug c/30075] New: Missed optimizations with -fwhole-program -combine ajax at redhat dot com
2006-12-05 18:47 ` [Bug middle-end/30075] Missed optimizations with static variable and static function pinskia at gcc dot gnu dot org
2006-12-05 19:37 ` [Bug c/30075] Missed optimizations with -fwhole-program -combine ajax at redhat dot com
2006-12-05 19:39 ` [Bug middle-end/30075] " pinskia at gcc dot gnu dot org
2006-12-06  2:55   ` Daniel Berlin
2006-12-06  2:55 ` dberlin at dberlin dot org
2007-06-26  3:10 ` acahalan at gmail dot com
2007-06-26 15:29   ` Daniel Berlin
2007-06-26 15:29 ` dberlin at dberlin dot org
2010-09-17  9:09 ` rguenth 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).