public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/46076] [4.6 regression] constant propagation and compile-time math no longer happening versus 4.4 and 4.5
Date: Tue, 19 Oct 2010 03:21:00 -0000	[thread overview]
Message-ID: <20101019032100.ghtf6R6Q4nnQEZSJ_Rd693TUjYxf0qBMgbD0YgqidOM@z> (raw)
In-Reply-To: <bug-46076-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> 2010-10-19 03:20:48 UTC ---
It is caused by fact that the main() function is optimized for size except for
code in loops because we know it will be executed once.
Inliner thinks that it is not good idea to inline printf.

The code size grows because we align the functions.
This is handled by the new ipa profile pass that recognizes the functions as
executed once.  With current mainline I get
0000000000400520 <main>:
  400520:       48 83 ec 08             sub    $0x8,%rsp
  400524:       bf 80 05 40 00          mov    $0x400580,%edi
  400529:       e8 12 00 00 00          callq  400540 <print>
  40052e:       bf 70 05 40 00          mov    $0x400570,%edi
  400533:       e8 08 00 00 00          callq  400540 <print>
  400538:       31 c0                   xor    %eax,%eax
  40053a:       48 83 c4 08             add    $0x8,%rsp
  40053e:       c3                      retq   
  40053f:       90                      nop

0000000000400540 <print>:
  400540:       53                      push   %rbx
  400541:       48 89 fb                mov    %rdi,%rbx
  400544:       ff d7                   callq  *%rdi
  400546:       bf 84 06 40 00          mov    $0x400684,%edi
  40054b:       0f b6 f0                movzbl %al,%esi
  40054e:       31 c0                   xor    %eax,%eax
  400550:       e8 bb fe ff ff          callq  400410 <printf@plt>
  400555:       ff d3                   callq  *%rbx
  400557:       5b                      pop    %rbx
  400558:       0f b6 f0                movzbl %al,%esi
  40055b:       bf 80 06 40 00          mov    $0x400680,%edi
  400560:       31 c0                   xor    %eax,%eax
  400562:       83 c6 01                add    $0x1,%esi
  400565:       e9 a6 fe ff ff          jmpq   400410 <printf@plt>
  40056a:       66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)

0000000000400570 <two>:
  400570:       b8 02 00 00 00          mov    $0x2,%eax
  400575:       c3                      retq   
  400576:       66 2e 0f 1f 84 00 00    nopw   %cs:0x0(%rax,%rax,1)
  40057d:       00 00 00 

0000000000400580 <one>:
  400580:       b8 01 00 00 00          mov    $0x1,%eax
  400585:       c3                      retq   
  400586:       90                      nop
  400587:       90                      nop
  400588:       90                      nop
  400589:       90                      nop
  40058a:       90                      nop
  40058b:       90                      nop
  40058c:       90                      nop
  40058d:       90                      nop
  40058e:       90                      nop
  40058f:       90                      nop

this is smaller (if I am counting right, original is 98 bytes, the code in
comment1 is 110 bytes and this code is 95 bytes including the alignment at the
end of section.)


  parent reply	other threads:[~2010-10-19  3:21 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18 21:01 [Bug middle-end/46076] New: [4.6 regression] constant propogation " matt at use dot net
2010-10-18 21:15 ` [Bug middle-end/46076] " pinskia at gcc dot gnu.org
2010-10-18 21:36 ` matt at use dot net
2010-10-19  0:20 ` [Bug middle-end/46076] [4.6 regression] constant propagation " hjl.tools at gmail dot com
2010-10-19  3:21 ` hubicka at gcc dot gnu.org [this message]
2010-10-19  3:25 ` hubicka at gcc dot gnu.org
2010-10-19  3:33 ` hubicka at gcc dot gnu.org
2010-10-19  4:43 ` pinskia at gcc dot gnu.org
     [not found] ` <20101019044304.166D0F0158@atrey.karlin.mff.cuni.cz>
2010-10-19  5:47   ` Jan Hubicka
2010-10-19  5:47 ` hubicka at ucw dot cz
2010-10-19 10:52 ` rguenth at gcc dot gnu.org
2010-10-20  8:22 ` jakub at gcc dot gnu.org
2010-11-04 13:05 ` [Bug c/46076] " rguenth at gcc dot gnu.org
2010-11-04 13:55 ` joseph at codesourcery dot com
2010-11-17 21:39 ` matt at use dot net
2010-11-18 11:53 ` rguenther at suse dot de
2010-11-18 12:12 ` hubicka at ucw dot cz
2010-11-18 12:23 ` rguenth at gcc dot gnu.org
2011-01-04 17:40 ` jamborm at gcc dot gnu.org
2011-01-11 14:44 ` rguenth at gcc dot gnu.org
2011-01-11 15:41 ` joseph at codesourcery dot com
2011-01-11 16:27 ` rguenth at gcc dot gnu.org
2011-01-11 17:03 ` rguenth at gcc dot gnu.org
2011-01-11 17:30 ` rguenth at gcc dot gnu.org
2011-01-14 13:04 ` rguenth at gcc dot gnu.org
2011-01-14 13:08 ` rguenth at gcc dot gnu.org
2011-03-25 21:14 ` [Bug c/46076] [4.6/4.7 " jakub at gcc dot gnu.org
2011-04-12 10:44 ` rguenth at gcc dot gnu.org
2011-04-12 16:24 ` matt at use dot net
2011-04-12 17:39 ` jakub at gcc dot gnu.org
2011-04-12 18:15 ` matt at use dot net
2011-04-12 22:32 ` rguenther at suse dot de
2011-06-27 16:22 ` [Bug tree-optimization/46076] [4.6 " jakub at gcc dot gnu.org
2011-10-26 17:56 ` jakub at gcc dot gnu.org
2012-03-01 15:20 ` jakub at gcc dot gnu.org
2012-03-23 20:35 ` matt at use dot net
2012-03-26  7:06 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101019032100.ghtf6R6Q4nnQEZSJ_Rd693TUjYxf0qBMgbD0YgqidOM@z \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).