public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n')
@ 2008-09-10 6:55 M dot Froehlich at science-computing dot de
2008-09-10 6:56 ` [Bug libstdc++/37455] " M dot Froehlich at science-computing dot de
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: M dot Froehlich at science-computing dot de @ 2008-09-10 6:55 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]
Using
gcc (GCC) 4.4.0 20080909 (experimental)
with optimization level -O3 to compile the attached c++ or .ii file, I get a
huge amount of assembly code.
See the attached source, precompiled source and assembly files.
If compiled with -Os or -O2 code size is way less.
The inlined code that appears to produce that sse instruction storm appears to
originates from ctype<char>::_M_widen_init in bits/locale_facets.h around line
1169.
I am not sure if this is a compiler/optimizer/inliner problem or if libstdc++
is just unlucky implementing the iostream/locale stuff. Since g++ compiles much
better overall optimized code with 4.4 compared to oprevious versions, I hope
that this can be fixed in libstdc++. Just my 2 cent ...
Thanks!
Mathias Fröhlich
--
Summary: Code bloat for ostream.widen('\n')
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: M dot Froehlich at science-computing dot de
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/37455] Code bloat for ostream.widen('\n')
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
@ 2008-09-10 6:56 ` M dot Froehlich at science-computing dot de
2008-09-10 6:57 ` M dot Froehlich at science-computing dot de
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: M dot Froehlich at science-computing dot de @ 2008-09-10 6:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from M dot Froehlich at science-computing dot de 2008-09-10 06:55 -------
Created an attachment (id=16277)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16277&action=view)
Original c++ code.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/37455] Code bloat for ostream.widen('\n')
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
2008-09-10 6:56 ` [Bug libstdc++/37455] " M dot Froehlich at science-computing dot de
@ 2008-09-10 6:57 ` M dot Froehlich at science-computing dot de
2008-09-10 6:57 ` M dot Froehlich at science-computing dot de
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: M dot Froehlich at science-computing dot de @ 2008-09-10 6:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from M dot Froehlich at science-computing dot de 2008-09-10 06:56 -------
Created an attachment (id=16278)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16278&action=view)
Preprocessed code.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/37455] Code bloat for ostream.widen('\n')
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
2008-09-10 6:56 ` [Bug libstdc++/37455] " M dot Froehlich at science-computing dot de
2008-09-10 6:57 ` M dot Froehlich at science-computing dot de
@ 2008-09-10 6:57 ` M dot Froehlich at science-computing dot de
2008-09-10 7:08 ` M dot Froehlich at science-computing dot de
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: M dot Froehlich at science-computing dot de @ 2008-09-10 6:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from M dot Froehlich at science-computing dot de 2008-09-10 06:56 -------
Created an attachment (id=16279)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16279&action=view)
Generated assembly file.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/37455] Code bloat for ostream.widen('\n')
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
` (2 preceding siblings ...)
2008-09-10 6:57 ` M dot Froehlich at science-computing dot de
@ 2008-09-10 7:08 ` M dot Froehlich at science-computing dot de
2008-09-10 15:25 ` paolo dot carlini at oracle dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: M dot Froehlich at science-computing dot de @ 2008-09-10 7:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from M dot Froehlich at science-computing dot de 2008-09-10 07:06 -------
Note that the code path in question is called with every
outputstream << std::endl;
Thanks
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/37455] Code bloat for ostream.widen('\n')
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
` (3 preceding siblings ...)
2008-09-10 7:08 ` M dot Froehlich at science-computing dot de
@ 2008-09-10 15:25 ` paolo dot carlini at oracle dot com
2008-09-10 15:35 ` paolo dot carlini at oracle dot com
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-09-10 15:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from paolo dot carlini at oracle dot com 2008-09-10 15:23 -------
Yes, but frankly it's unlikely that in 4.4.0 timeframe, also given the ABI
constraints, we can change the libstdc++ implementation, which admittedly has
too much code inline in this area, enough to solve this problem. We are just
unlucky that 4.3.x was less aggressive at -O3, nothing changed lately (and also
less recently) on the library side...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/37455] Code bloat for ostream.widen('\n')
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
` (4 preceding siblings ...)
2008-09-10 15:25 ` paolo dot carlini at oracle dot com
@ 2008-09-10 15:35 ` paolo dot carlini at oracle dot com
2008-09-10 15:39 ` M dot Froehlich at science-computing dot de
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-09-10 15:35 UTC (permalink / raw)
To: gcc-bugs
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |paolo dot carlini at oracle
|dot org |dot com
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-09-10 15:34:19
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/37455] Code bloat for ostream.widen('\n')
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
` (5 preceding siblings ...)
2008-09-10 15:35 ` paolo dot carlini at oracle dot com
@ 2008-09-10 15:39 ` M dot Froehlich at science-computing dot de
2008-09-10 15:56 ` paolo dot carlini at oracle dot com
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: M dot Froehlich at science-computing dot de @ 2008-09-10 15:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from M dot Froehlich at science-computing dot de 2008-09-10 15:38 -------
(In reply to comment #5)
> Yes, but frankly it's unlikely that in 4.4.0 timeframe, also given the ABI
> constraints, we can change the libstdc++ implementation, which admittedly has
> too much code inline in this area, enough to solve this problem. We are just
> unlucky that 4.3.x was less aggressive at -O3, nothing changed lately (and also
> less recently) on the library side...
Ok, one idea I have while reading your comment:
Gcc has that per function optimization attributes - may be an
__attribute__((optimize ('Os'))) or something similar helps for some selected
functions in this area?
Greetings
Mathias
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/37455] Code bloat for ostream.widen('\n')
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
` (6 preceding siblings ...)
2008-09-10 15:39 ` M dot Froehlich at science-computing dot de
@ 2008-09-10 15:56 ` paolo dot carlini at oracle dot com
2008-09-10 16:14 ` M dot Froehlich at science-computing dot de
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-09-10 15:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from paolo dot carlini at oracle dot com 2008-09-10 15:54 -------
I have a patch in testing which changes -O3 to be the same as -O2, essentially
I moved _M_narrow_init and _M_widen_init out of line. For further tweaks,
really after 4.4.0.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/37455] Code bloat for ostream.widen('\n')
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
` (7 preceding siblings ...)
2008-09-10 15:56 ` paolo dot carlini at oracle dot com
@ 2008-09-10 16:14 ` M dot Froehlich at science-computing dot de
2008-09-10 16:22 ` [Bug libstdc++/37455] [4.4 Regression] " paolo dot carlini at oracle dot com
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: M dot Froehlich at science-computing dot de @ 2008-09-10 16:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from M dot Froehlich at science-computing dot de 2008-09-10 16:13 -------
Fine!
Thanks!
Mathias
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/37455] [4.4 Regression] Code bloat for ostream.widen('\n')
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
` (8 preceding siblings ...)
2008-09-10 16:14 ` M dot Froehlich at science-computing dot de
@ 2008-09-10 16:22 ` paolo dot carlini at oracle dot com
2008-09-10 16:51 ` paolo at gcc dot gnu dot org
2008-09-10 16:53 ` paolo dot carlini at oracle dot com
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-09-10 16:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from paolo dot carlini at oracle dot com 2008-09-10 16:20 -------
This is a regression, not horribly serious still a regression.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Code bloat for |[4.4 Regression] Code bloat
|ostream.widen('\n') |for ostream.widen('\n')
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/37455] [4.4 Regression] Code bloat for ostream.widen('\n')
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
` (9 preceding siblings ...)
2008-09-10 16:22 ` [Bug libstdc++/37455] [4.4 Regression] " paolo dot carlini at oracle dot com
@ 2008-09-10 16:51 ` paolo at gcc dot gnu dot org
2008-09-10 16:53 ` paolo dot carlini at oracle dot com
11 siblings, 0 replies; 13+ messages in thread
From: paolo at gcc dot gnu dot org @ 2008-09-10 16:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from paolo at gcc dot gnu dot org 2008-09-10 16:49 -------
Subject: Bug 37455
Author: paolo
Date: Wed Sep 10 16:48:47 2008
New Revision: 140238
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140238
Log:
2008-09-10 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/37455
* include/bits/locale_facets.h (ctype<char>::_M_narrow_init,
ctype<char>::_M_widen_init): Don't define inline.
* config/locale/darwin/ctype_members.cc: ... define here.
* config/locale/gnu/ctype_members.cc: ... likewise.
* config/locale/generic/ctype_members.cc: ... likewise.
* config/abi/pre/gnu.ver: Export.
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/config/abi/pre/gnu.ver
trunk/libstdc++-v3/config/locale/darwin/ctype_members.cc
trunk/libstdc++-v3/config/locale/generic/ctype_members.cc
trunk/libstdc++-v3/config/locale/gnu/ctype_members.cc
trunk/libstdc++-v3/include/bits/locale_facets.h
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/37455] [4.4 Regression] Code bloat for ostream.widen('\n')
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
` (10 preceding siblings ...)
2008-09-10 16:51 ` paolo at gcc dot gnu dot org
@ 2008-09-10 16:53 ` paolo dot carlini at oracle dot com
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-09-10 16:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from paolo dot carlini at oracle dot com 2008-09-10 16:51 -------
Fixed.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37455
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2008-09-10 16:53 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-10 6:55 [Bug libstdc++/37455] New: Code bloat for ostream.widen('\n') M dot Froehlich at science-computing dot de
2008-09-10 6:56 ` [Bug libstdc++/37455] " M dot Froehlich at science-computing dot de
2008-09-10 6:57 ` M dot Froehlich at science-computing dot de
2008-09-10 6:57 ` M dot Froehlich at science-computing dot de
2008-09-10 7:08 ` M dot Froehlich at science-computing dot de
2008-09-10 15:25 ` paolo dot carlini at oracle dot com
2008-09-10 15:35 ` paolo dot carlini at oracle dot com
2008-09-10 15:39 ` M dot Froehlich at science-computing dot de
2008-09-10 15:56 ` paolo dot carlini at oracle dot com
2008-09-10 16:14 ` M dot Froehlich at science-computing dot de
2008-09-10 16:22 ` [Bug libstdc++/37455] [4.4 Regression] " paolo dot carlini at oracle dot com
2008-09-10 16:51 ` paolo at gcc dot gnu dot org
2008-09-10 16:53 ` paolo dot carlini at oracle dot com
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).