From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106018 invoked by alias); 24 Jul 2017 19:08:36 -0000 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 Received: (qmail 105628 invoked by uid 89); 24 Jul 2017 19:08:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=HTo:D*gwu.edu, Hx-languages-length:1244, tomorrow X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Jul 2017 19:08:34 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 97B7A5489D7; Mon, 24 Jul 2017 21:08:32 +0200 (CEST) Date: Mon, 24 Jul 2017 19:08:00 -0000 From: Jan Hubicka To: Eric Gallager Cc: gcc-patches Subject: Re: Add -Wsuggest-attribute=cold Message-ID: <20170724190832.GA76225@kam.mff.cuni.cz> References: <20170724185633.GA43541@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2017-07/txt/msg01447.txt.bz2 > On Mon, Jul 24, 2017 at 2:56 PM, Jan Hubicka wrote: > > Hi, > > this patch adds -Wsuggest-attribute=cold because we can now statically detect > > cold functions atuomatically. > > > > Bootstrapped/regtested x86_64-linux. Plan to commit it tomorrow if there are no > > complains. > > > > Honza > > > > * invoke.texi (Wsuggest-attribute=cold): Document. > > * common.opt (Wsuggest-attribute=cold): New > > * ipa-pure-const.c (warn_function_cold): New function. > > * predict.c (compute_function_frequency): Use it. > > * predict.h (warn_function_cold): Declare. > > > > * gcc.dg/cold-1.c: New testcase. > > Would it be possible to also do -Wsuggest-attribute=hot for symmetry's > sake? Just wondering. It would be nice, but it is kind of impossible to detect hot spots of the program with reasonable certainity. (that is why profile feedback is useful :) This cold attribute detection looks really for very simple pattern where the function inavoidably calls other cold function or does something similarly unlikely (Eh or trap). This is fairly limited pattern, but it is useful i.e. to detect which libstdc++ functions can have this annotation that further improve branch prediction. Honza