From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16532 invoked by alias); 24 Sep 2010 18:41:32 -0000 Received: (qmail 16523 invoked by uid 22791); 24 Sep 2010 18:41:31 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 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; Fri, 24 Sep 2010 18:41:25 +0000 From: "sje at cup dot hp.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/45781] New: GCC incorrectly puts function in .text.unlikely X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sje at cup dot hp.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Fri, 24 Sep 2010 18:42: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-09/txt/msg02725.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45781 Summary: GCC incorrectly puts function in .text.unlikely Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: sje@cup.hp.com Created attachment 21875 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=21875 Test case If you compile the attached test case (x.c) with -O2 on ToT sources you will find that init_target_chars is put into .text.unlikely instead of .text. I have verified this on IA64 HP-UX and Linux and on X86 Linux. I do not think this function should be put into .text.unlikely in this case and GCC 4.5 does not do so. It looks like this started with Honza's partial inlining change (r161382). The following patch seems to fix the problem but I am not sure if it is the correct fix or not. Should node->frequency always be set in this case or should the original value be preserved if no attribute is seen. I do not believe node->frequency is uninitialized because if I change the frequeny enum in cgraph.h to make NODE_FREQUENCY_NORMAL a 0 value, the frequency is still set to NODE_FREQUENCY_UNLIKELY_EXECUTED (unless I change predict.c). Index: predict.c =================================================================== --- predict.c (revision 164573) +++ predict.c (working copy) @@ -2204,6 +2204,8 @@ compute_function_frequency (void) else if (DECL_STATIC_CONSTRUCTOR (current_function_decl) || DECL_STATIC_DESTRUCTOR (current_function_decl)) node->frequency = NODE_FREQUENCY_EXECUTED_ONCE; + else + node->frequency = NODE_FREQUENCY_NORMAL; return; } node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED; -- Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.