public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/47916] New: Using -flto leads to halved performance of unrar unarchiver
@ 2011-02-27 19:37 t.artem at mailcity dot com
  2011-02-27 19:40 ` [Bug lto/47916] " t.artem at mailcity dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: t.artem at mailcity dot com @ 2011-02-27 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Using -flto leads to halved performance of unrar
                    unarchiver
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: t.artem@mailcity.com


Created attachment 23483
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23483
unrar sources

Using the last released GCC snapshot (gcc-4.6-20110226) and the following
compilation flags performance halves.

GCC flags used:

CXXFLAGS=-O2 -march=i686 -mtune=generic [-flto|]
LDFLAGS=[-flto|]

Execution times:



With -flto:

time ./unrar t -inul testarchive.rar

real    0m33.496s
user    0m33.171s
sys     0m0.140s




Without -flto:

time ./unrar t -inul testarchive.rar

real    0m16.326s
user    0m16.242s
sys     0m0.067s

___________________________________________________________________

This bug will probably attract zero attention from GCC developers but since
-flto is not meant to behave such badly I'm posting it.

You can produce a rar archive using Rar for Linux
(http://rarlabs.com/download.htm):

rar a -m5 -mdG -r -s archive.name.rar file1 file2 file3 ... etc.


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

* [Bug lto/47916] Using -flto leads to halved performance of unrar unarchiver
  2011-02-27 19:37 [Bug lto/47916] New: Using -flto leads to halved performance of unrar unarchiver t.artem at mailcity dot com
@ 2011-02-27 19:40 ` t.artem at mailcity dot com
  2011-02-27 19:55 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: t.artem at mailcity dot com @ 2011-02-27 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

Artem S. Tashkinov <t.artem at mailcity dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |lto, missed-optimization
             Target|                            |i686-pc-linux-gnu
               Host|                            |i686-pc-linux-gnu

--- Comment #1 from Artem S. Tashkinov <t.artem at mailcity dot com> 2011-02-27 19:37:02 UTC ---
I'm not sure about missed-optimization keyword, so feel free to remove it if it
doesn't fit this bug.

GCC 4.5.2 produces the similar results, so it's not a regression.


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

* [Bug lto/47916] Using -flto leads to halved performance of unrar unarchiver
  2011-02-27 19:37 [Bug lto/47916] New: Using -flto leads to halved performance of unrar unarchiver t.artem at mailcity dot com
  2011-02-27 19:40 ` [Bug lto/47916] " t.artem at mailcity dot com
@ 2011-02-27 19:55 ` rguenth at gcc dot gnu.org
  2011-02-27 21:06 ` t.artem at mailcity dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-27 19:55 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011.02.27 19:46:22
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-02-27 19:46:22 UTC ---
LDFLAGS needs to include -O2 -march=i686 -mtune=generic as well, can you make
sure the Makefile does that?


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

* [Bug lto/47916] Using -flto leads to halved performance of unrar unarchiver
  2011-02-27 19:37 [Bug lto/47916] New: Using -flto leads to halved performance of unrar unarchiver t.artem at mailcity dot com
  2011-02-27 19:40 ` [Bug lto/47916] " t.artem at mailcity dot com
  2011-02-27 19:55 ` rguenth at gcc dot gnu.org
@ 2011-02-27 21:06 ` t.artem at mailcity dot com
  2011-02-27 22:31 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: t.artem at mailcity dot com @ 2011-02-27 21:06 UTC (permalink / raw)
  To: gcc-bugs

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

Artem S. Tashkinov <t.artem at mailcity dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Artem S. Tashkinov <t.artem at mailcity dot com> 2011-02-27 20:57:51 UTC ---
My bad!

export LDFLAGS=-O2 -march=i686 -mtune=generic -flto

has solved the problem.

However the performance gain from -flto is still negative (0.5%) :)


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

* [Bug lto/47916] Using -flto leads to halved performance of unrar unarchiver
  2011-02-27 19:37 [Bug lto/47916] New: Using -flto leads to halved performance of unrar unarchiver t.artem at mailcity dot com
                   ` (2 preceding siblings ...)
  2011-02-27 21:06 ` t.artem at mailcity dot com
@ 2011-02-27 22:31 ` rguenth at gcc dot gnu.org
  2011-02-27 22:47 ` t.artem at mailcity dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-27 22:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-02-27 21:03:31 UTC ---
(In reply to comment #3)
> My bad!
> 
> export LDFLAGS=-O2 -march=i686 -mtune=generic -flto
> 
> has solved the problem.

Yeah, I guess it will be one of the more common mistakes ;)

> However the performance gain from -flto is still negative (0.5%) :)

At the moment I would not expect much performance benefit from LTO
(basically it provides inter-module inlining).  What we see is
consistently smaller binaries with comparable performance though.


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

* [Bug lto/47916] Using -flto leads to halved performance of unrar unarchiver
  2011-02-27 19:37 [Bug lto/47916] New: Using -flto leads to halved performance of unrar unarchiver t.artem at mailcity dot com
                   ` (3 preceding siblings ...)
  2011-02-27 22:31 ` rguenth at gcc dot gnu.org
@ 2011-02-27 22:47 ` t.artem at mailcity dot com
  2011-02-27 23:20 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: t.artem at mailcity dot com @ 2011-02-27 22:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Artem S. Tashkinov <t.artem at mailcity dot com> 2011-02-27 21:06:04 UTC ---
Thanks for the explanation!

I'm not sure if it's worth opening a new bug report, but GCC crashes when I try
to use -fprofile-generate/-fprofile-use together with -flto:

g++ -o unrar -O3 -march=core2 -fomit-frame-pointer -fprofile-use -flto rar.o
strlist.o strfn.o pathfn.o savepos.o smallfn.o global.o file.o filefn.o
filcreat.o archive.o arcread.o unicode.o system.o isnt.o crypt.o crc.o
rawread.o encname.o resource.o match.o timefn.o rdwrfn.o consio.o options.o
ulinks.o errhnd.o rarvm.o rijndael.o getbits.o sha1.o extinfo.o extract.o
volume.o list.o find.o unpack.o cmddata.o filestr.o recvol.o rs.o scantree.o
In file included from :43:0:
unpack.cpp: In member function ‘Unpack29’:
unpack.cpp:202:6: internal compiler error: in duplicate_loop_to_header_edge, at
cfgloopmanip.c:1115
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

At first I built unrar using:
CXXFLAGS=LDFLAGS=-O3 -march=core2 -fomit-frame-pointer -fprofile-generate -flto 

then I made a testrun of unrar, then erased object files, then tried to compile
it again using:

CXXFLAGS=LDFLAGS=-O3 -march=core2 -fomit-frame-pointer -fprofile-use -flto


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

* [Bug lto/47916] Using -flto leads to halved performance of unrar unarchiver
  2011-02-27 19:37 [Bug lto/47916] New: Using -flto leads to halved performance of unrar unarchiver t.artem at mailcity dot com
                   ` (4 preceding siblings ...)
  2011-02-27 22:47 ` t.artem at mailcity dot com
@ 2011-02-27 23:20 ` rguenth at gcc dot gnu.org
  2011-02-28  8:56   ` Jan Hubicka
  2011-02-27 23:30 ` t.artem at mailcity dot com
  2011-02-28  8:58 ` hubicka at ucw dot cz
  7 siblings, 1 reply; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-27 23:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-02-27 23:13:02 UTC ---
(In reply to comment #5)
> Thanks for the explanation!
> 
> I'm not sure if it's worth opening a new bug report, but GCC crashes when I try
> to use -fprofile-generate/-fprofile-use together with -flto:
> 
> g++ -o unrar -O3 -march=core2 -fomit-frame-pointer -fprofile-use -flto rar.o
> strlist.o strfn.o pathfn.o savepos.o smallfn.o global.o file.o filefn.o
> filcreat.o archive.o arcread.o unicode.o system.o isnt.o crypt.o crc.o
> rawread.o encname.o resource.o match.o timefn.o rdwrfn.o consio.o options.o
> ulinks.o errhnd.o rarvm.o rijndael.o getbits.o sha1.o extinfo.o extract.o
> volume.o list.o find.o unpack.o cmddata.o filestr.o recvol.o rs.o scantree.o
> In file included from :43:0:
> unpack.cpp: In member function ‘Unpack29’:
> unpack.cpp:202:6: internal compiler error: in duplicate_loop_to_header_edge, at
> cfgloopmanip.c:1115
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <http://gcc.gnu.org/bugs.html> for instructions.
> 
> At first I built unrar using:
> CXXFLAGS=LDFLAGS=-O3 -march=core2 -fomit-frame-pointer -fprofile-generate -flto 
> 
> then I made a testrun of unrar, then erased object files, then tried to compile
> it again using:
> 
> CXXFLAGS=LDFLAGS=-O3 -march=core2 -fomit-frame-pointer -fprofile-use -flto

That should work.  The error is a sanity check that profile information
is sane.


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

* [Bug lto/47916] Using -flto leads to halved performance of unrar unarchiver
  2011-02-27 19:37 [Bug lto/47916] New: Using -flto leads to halved performance of unrar unarchiver t.artem at mailcity dot com
                   ` (5 preceding siblings ...)
  2011-02-27 23:20 ` rguenth at gcc dot gnu.org
@ 2011-02-27 23:30 ` t.artem at mailcity dot com
  2011-02-28  8:58 ` hubicka at ucw dot cz
  7 siblings, 0 replies; 10+ messages in thread
From: t.artem at mailcity dot com @ 2011-02-27 23:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Artem S. Tashkinov <t.artem at mailcity dot com> 2011-02-27 23:26:52 UTC ---
> That should work.  The error is a sanity check that profile information
> is sane.

I don't get you :( It seems like you say two opposite things.


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

* Re: [Bug lto/47916] Using -flto leads to halved performance of unrar unarchiver
  2011-02-27 23:20 ` rguenth at gcc dot gnu.org
@ 2011-02-28  8:56   ` Jan Hubicka
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Hubicka @ 2011-02-28  8:56 UTC (permalink / raw)
  To: rguenth at gcc dot gnu.org; +Cc: gcc-bugs

> That should work.  The error is a sanity check that profile information
> is sane.
Obviously given that sanity of profile can break for valid reasons, we should not ICE
when this happen.  I will try to look how it becomes insane here however.

Honza


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

* [Bug lto/47916] Using -flto leads to halved performance of unrar unarchiver
  2011-02-27 19:37 [Bug lto/47916] New: Using -flto leads to halved performance of unrar unarchiver t.artem at mailcity dot com
                   ` (6 preceding siblings ...)
  2011-02-27 23:30 ` t.artem at mailcity dot com
@ 2011-02-28  8:58 ` hubicka at ucw dot cz
  7 siblings, 0 replies; 10+ messages in thread
From: hubicka at ucw dot cz @ 2011-02-28  8:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jan Hubicka <hubicka at ucw dot cz> 2011-02-28 08:55:46 UTC ---
> That should work.  The error is a sanity check that profile information
> is sane.
Obviously given that sanity of profile can break for valid reasons, we should
not ICE
when this happen.  I will try to look how it becomes insane here however.

Honza


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

end of thread, other threads:[~2011-02-28  8:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-27 19:37 [Bug lto/47916] New: Using -flto leads to halved performance of unrar unarchiver t.artem at mailcity dot com
2011-02-27 19:40 ` [Bug lto/47916] " t.artem at mailcity dot com
2011-02-27 19:55 ` rguenth at gcc dot gnu.org
2011-02-27 21:06 ` t.artem at mailcity dot com
2011-02-27 22:31 ` rguenth at gcc dot gnu.org
2011-02-27 22:47 ` t.artem at mailcity dot com
2011-02-27 23:20 ` rguenth at gcc dot gnu.org
2011-02-28  8:56   ` Jan Hubicka
2011-02-27 23:30 ` t.artem at mailcity dot com
2011-02-28  8:58 ` hubicka at ucw dot cz

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).