public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12219] New: inline doesn't always cause inlining, even when it's possible
@ 2003-09-08 22:57 dbaron at dbaron dot org
  2003-09-08 23:02 ` [Bug c++/12219] " dbaron at dbaron dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dbaron at dbaron dot org @ 2003-09-08 22:57 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=12219

           Summary: inline doesn't always cause inlining, even when it's
                    possible
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dbaron at dbaron dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

There are cases where inline doesn't cause inlining, but
__attribute__((always_inline)) causes inlining and improves the performance of
the code.  Having to resort to __attribute__((always_inline)) is rather ugly,
especially in code that also has to compile on other compilers.

This is filed as suggested in bug 11680 comment 4.

A testcase is attachment 4487 (from bug 11680).

Steps to reproduce:
 1. Compile attachment 4487 using -O2.
 2. time "<executable> original" and "<executable> slow".
 3. Modify the attachment to comment out the __attribute__((always_inline))
(and, if you want, add |inline|, although C++ says it's implied for methods
defined inside of class defitions, and it doesn't make a difference) in the
class ConvertUTF16toUTF8_slow
 4. recompile

Expected results:
 2. The two take the same amount of time.
 4. There is no change in the size of the binary.

Actual results:
 2. "slow" is faster than "original".
 4. the binary is bigger without the __attribute__((always_inline))


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

* [Bug c++/12219] inline doesn't always cause inlining, even when it's possible
  2003-09-08 22:57 [Bug c++/12219] New: inline doesn't always cause inlining, even when it's possible dbaron at dbaron dot org
@ 2003-09-08 23:02 ` dbaron at dbaron dot org
  2003-09-09  0:05 ` zack at gcc dot gnu dot org
  2003-09-09  1:36 ` dbaron at dbaron dot org
  2 siblings, 0 replies; 4+ messages in thread
From: dbaron at dbaron dot org @ 2003-09-08 23:02 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=12219



------- Additional Comments From dbaron at dbaron dot org  2003-09-08 23:02 -------
(I'm seeing this both with gcc 3.3.1 and with the trunk as of 20030908.)


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

* [Bug c++/12219] inline doesn't always cause inlining, even when it's possible
  2003-09-08 22:57 [Bug c++/12219] New: inline doesn't always cause inlining, even when it's possible dbaron at dbaron dot org
  2003-09-08 23:02 ` [Bug c++/12219] " dbaron at dbaron dot org
@ 2003-09-09  0:05 ` zack at gcc dot gnu dot org
  2003-09-09  1:36 ` dbaron at dbaron dot org
  2 siblings, 0 replies; 4+ messages in thread
From: zack at gcc dot gnu dot org @ 2003-09-09  0:05 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=12219



------- Additional Comments From zack at gcc dot gnu dot org  2003-09-09 00:05 -------
Please post results for -O2 -fno-unit-at-a-time and -O2 -funit-at-a-time.  I am
not sure what the current default is for that switch, but this is the sort of
thing that unit-at-a-time mode was intended to address.


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

* [Bug c++/12219] inline doesn't always cause inlining, even when it's possible
  2003-09-08 22:57 [Bug c++/12219] New: inline doesn't always cause inlining, even when it's possible dbaron at dbaron dot org
  2003-09-08 23:02 ` [Bug c++/12219] " dbaron at dbaron dot org
  2003-09-09  0:05 ` zack at gcc dot gnu dot org
@ 2003-09-09  1:36 ` dbaron at dbaron dot org
  2 siblings, 0 replies; 4+ messages in thread
From: dbaron at dbaron dot org @ 2003-09-09  1:36 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=12219


dbaron at dbaron dot org changed:

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


------- Additional Comments From dbaron at dbaron dot org  2003-09-09 01:36 -------
I thought I saw this earlier today using the trunk, but I must have been using
3.3.  I don't see the bug using the trunk anymore, which is consistent with bug
11680 comment 2.


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

end of thread, other threads:[~2003-09-09  1:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-08 22:57 [Bug c++/12219] New: inline doesn't always cause inlining, even when it's possible dbaron at dbaron dot org
2003-09-08 23:02 ` [Bug c++/12219] " dbaron at dbaron dot org
2003-09-09  0:05 ` zack at gcc dot gnu dot org
2003-09-09  1:36 ` dbaron at dbaron 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).