From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32235 invoked by alias); 19 Oct 2010 03:21:04 -0000 Received: (qmail 32226 invoked by uid 22791); 19 Oct 2010 03:21:02 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID,TW_VZ,TW_ZB X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Oct 2010 03:20:57 +0000 From: "hubicka at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 19 Oct 2010 03:21:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-10/txt/msg01556.txt.bz2 Message-ID: <20101019032100.ghtf6R6Q4nnQEZSJ_Rd693TUjYxf0qBMgbD0YgqidOM@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46076 --- Comment #4 from Jan Hubicka 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
: 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 40052e: bf 70 05 40 00 mov $0x400570,%edi 400533: e8 08 00 00 00 callq 400540 400538: 31 c0 xor %eax,%eax 40053a: 48 83 c4 08 add $0x8,%rsp 40053e: c3 retq 40053f: 90 nop 0000000000400540 : 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 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 40056a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) 0000000000400570 : 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 : 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.)