From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15438 invoked by alias); 8 Apr 2008 22:31:15 -0000 Received: (qmail 15421 invoked by uid 22791); 8 Apr 2008 22:31:11 -0000 X-Spam-Check-By: sourceware.org Received: from nikam-dmz.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 08 Apr 2008 22:30:52 +0000 Received: from localhost (occam.ms.mff.cuni.cz [195.113.18.121]) by nikam.ms.mff.cuni.cz (Postfix) with ESMTP id 670F615359B; Wed, 9 Apr 2008 00:30:49 +0200 (CEST) Received: by localhost (Postfix, from userid 16202) id 5AF2193743; Wed, 9 Apr 2008 00:30:49 +0200 (CEST) Date: Tue, 08 Apr 2008 22:52:00 -0000 From: Jan Hubicka To: Mark Mitchell Cc: Jan Hubicka , Richard Guenther , gcc-patches@gcc.gnu.org Subject: Re: Patch ping... Message-ID: <20080408223049.GJ16935@kam.mff.cuni.cz> References: <20080405162606.GA22594@atrey.karlin.mff.cuni.cz> <84fc9c000804050953o429fde26jb3938827ff9dc5a@mail.gmail.com> <20080405195910.GF28471@atrey.karlin.mff.cuni.cz> <47FBCEF5.50001@codesourcery.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47FBCEF5.50001@codesourcery.com> User-Agent: Mutt/1.5.9i Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2008-04/txt/msg00728.txt.bz2 > Jan Hubicka wrote: > > >I would like to have hot_bb_p predicate that take into accounts the > >hints: > > 1) hot/cold function attributes > > 2) -Os versus optimize_size > > 3) function local profile (ie things guarded with __builtin_expect or > > leading to abort) > > 4) profile feedback > >and decide on hotness. With -Os defaulting to conservative behaviour > >(ie function is hot only if attribute or profile feedback suggest so) > >and -O2 defaulting to aggressive behaviour (function is hot if not > >declared cold, function local profile is within bounds). > > This seems like a good idea, except that I'm not sure it's what people > really want from -Os. With -Os, I think some users want small code, all > the time, period. What I think -Os can be really useful for is well maintained code base, with code size constraints. (Linux kernel) You compile it with -Os and get small code except for the case you explicitly use __attribute__ ((hot)). Given the observation that just tiny portion of program is hot, it in general makes more sense than using -O2/-O3 and cold attribute. We however can't make this default behaviour for -O2, since we can't insist on user always marking hot functions hot in random package. I am less sure about profile feedback. Feedback with -Os can either mean "figure hotness yourself" or "get the code faster without increasing code size". To some degree I however expect that "get me the smallest code" people probably won't bother with profile feedback anyway. Honza > > -- > Mark Mitchell > CodeSourcery > mark@codesourcery.com > (650) 331-3385 x713