From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id E5DA83858C52 for ; Sat, 29 Oct 2022 04:28:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E5DA83858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x62b.google.com with SMTP id p21so2617932plr.7 for ; Fri, 28 Oct 2022 21:28:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=p3mWxpdWjZzwNJyaxQHE3l05SopMzlrkXo1WE+Auj0I=; b=JpqjDQESwecL24GveTujI1AEhxGD6eiMcJe00gk7cJOJhwiKuZtOGvD61JoO6iUHBp 3262hlJgC4LX5w16UWPoT3EISMh1pWjrRjR6OjSZuvrmPK6twb3vwkNjDxa7lHIgCPE8 WuOFifcov6u0GdFLYFzMVkVTmaNhVJawURT7W85I1LnWYQNYX66skraJ+0+DZEqZ0Z9V e++IO7ansggLlmXbSVc6nkJhv5b+0YfczMj2bEDG8NyttfzHhi92wKAW/SCqDiudlNZ8 7cmffvBi2mvvEGXDM48SlOOf7ul2X6qW4F/rfIKwEMj/pNJZjM7sfaIitMrD2CKhqW7v cR6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=p3mWxpdWjZzwNJyaxQHE3l05SopMzlrkXo1WE+Auj0I=; b=aT3GEM2gjl+goMHiZubCltK48TCavkFVmeLNsy8BN4IgSkQN+daLzZgykfX87vFWpQ xVge1kFjQgtIya0PC+ACJsvoGqPWYnNi8OxTuQ9ZFvAdatdx+6ndFZhEIBVGtn3Dhkmg +iHYWvk3NyuBvD7DDgIXmnqpmimHVrHwOW2fFZqahwmqM/chNCvdChpRz8yfpwLrSVJ4 wM6OKZuA1gwWLWxf+2cbgreh48wH+coVQ493RzOXMLI0JQ2UrSfAR9rf5iPURfodmpCO j+IUvRbpU/dja3jpCCPKLknp9WjobLggqUg/Q1rEEeRb3JWoJ+s3Us2VRC04TObkz9+P B/WA== X-Gm-Message-State: ACrzQf0rMaqkqcfwJ31AMniXKjDOUiCQE6j0jeXLmCVn0AzqFv5ybmdC QBUAN10NOzfw8hGkyVAcn/4= X-Google-Smtp-Source: AMsMyM4hXVbyyKl9mJb99/m/zIMzO8k8lni+pNfTM8Q8orS1I8NtJ6ah6EbdmcTgqN4KBHT5nSWuUg== X-Received: by 2002:a17:90b:4b47:b0:20a:cfcb:8561 with SMTP id mi7-20020a17090b4b4700b0020acfcb8561mr2814910pjb.55.1667017698802; Fri, 28 Oct 2022 21:28:18 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id u16-20020a170902e5d000b0017f8094a52asm292751plf.29.2022.10.28.21.28.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 21:28:18 -0700 (PDT) Message-ID: <1eed381a-708c-8ea7-9010-ecc144ab959c@gmail.com> Date: Fri, 28 Oct 2022 22:28:17 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: Ping^3 [PATCH V2] Add attribute hot judgement for INLINE_HINT_known_hot hint. Content-Language: en-US To: "Cui, Lili" , Jan Hubicka , "jh@suse.cz" Cc: "Lu, Hongjiu" , "Liu, Hongtao" , "gcc-patches@gcc.gnu.org" References: <20220920084810.25157-1-lili.cui@intel.com> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 10/20/22 19:52, Cui, Lili via Gcc-patches wrote: > Hi Honza, > > Gentle ping https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601934.html > > gcc/ChangeLog > > * ipa-inline-analysis.cc (do_estimate_edge_time): Add function attribute > judgement for INLINE_HINT_known_hot hint. > > gcc/testsuite/ChangeLog: > > * gcc.dg/ipa/inlinehint-6.c: New test. > --- > gcc/ipa-inline-analysis.cc | 13 ++++--- > gcc/testsuite/gcc.dg/ipa/inlinehint-6.c | 47 +++++++++++++++++++++++++ > 2 files changed, 56 insertions(+), 4 deletions(-) > create mode 100644 gcc/testsuite/gcc.dg/ipa/inlinehint-6.c > > diff --git a/gcc/ipa-inline-analysis.cc b/gcc/ipa-inline-analysis.cc > index 1ca685d1b0e..7bd29c36590 100644 > --- a/gcc/ipa-inline-analysis.cc > +++ b/gcc/ipa-inline-analysis.cc > @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see > #include "ipa-utils.h" > #include "cfgexpand.h" > #include "gimplify.h" > +#include "attribs.h" > > /* Cached node/edge growths. */ > fast_call_summary *edge_growth_cache = NULL; > @@ -249,15 +250,19 @@ do_estimate_edge_time (struct cgraph_edge *edge, sreal *ret_nonspec_time) > hints = estimates.hints; > } > > - /* When we have profile feedback, we can quite safely identify hot > - edges and for those we disable size limits. Don't do that when > - probability that caller will call the callee is low however, since it > + /* When we have profile feedback or function attribute, we can quite safely > + identify hot edges and for those we disable size limits. Don't do that > + when probability that caller will call the callee is low however, since it > may hurt optimization of the caller's hot path. */ > - if (edge->count.ipa ().initialized_p () && edge->maybe_hot_p () > + if ((edge->count.ipa ().initialized_p () && edge->maybe_hot_p () > && (edge->count.ipa () * 2 > > (edge->caller->inlined_to > ? edge->caller->inlined_to->count.ipa () > : edge->caller->count.ipa ()))) > + || (lookup_attribute ("hot", DECL_ATTRIBUTES (edge->caller->decl)) > + != NULL > + && lookup_attribute ("hot", DECL_ATTRIBUTES (edge->callee->decl)) > + != NULL)) > hints |= INLINE_HINT_known_hot; Is the theory here that if the user has marked the caller and callee as hot, then we're going to assume an edge between them is hot too?  That's not necessarily true, it could be they're both hot, but via other call chains.  But it's probably a reasonable heuristic in practice. OK jeff