From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 108333 invoked by alias); 12 Aug 2019 14:59:46 -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 108325 invoked by uid 89); 12 Aug 2019 14:59:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=directed, dump_printf X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Aug 2019 14:59:45 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 17DCFC0740DF; Mon, 12 Aug 2019 14:59:44 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-27.rdu2.redhat.com [10.10.112.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17B5171C95; Mon, 12 Aug 2019 14:59:42 +0000 (UTC) Subject: Re: [PATCH] Port value profiling to -fopt-info infrastructure. To: =?UTF-8?Q?Martin_Li=c5=a1ka?= , Richard Biener Cc: GCC Patches References: <5d86ba1f-cf38-3a69-8b9f-60a108922243@suse.cz> <5a1e050b-1c36-3b3f-15d5-7a2bec71e111@redhat.com> <4a45e830-5813-ebff-fb3a-61645848c422@suse.cz> From: Jeff Law Openpgp: preference=signencrypt Message-ID: <4327d9af-6afc-251a-26d2-531582fbfc3d@redhat.com> Date: Mon, 12 Aug 2019 15:17:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <4a45e830-5813-ebff-fb3a-61645848c422@suse.cz> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg00748.txt.bz2 On 8/9/19 7:13 AM, Martin Liška wrote: > On 8/9/19 10:13 AM, Richard Biener wrote: >> On Thu, Aug 8, 2019 at 4:17 PM Jeff Law wrote: >>> On 8/8/19 7:04 AM, Martin Liška wrote: >>>> Hi. >>>> >>>> As requested by Richi, I'm suggesting to use new dump_printf >>>> optimization info infrastructure. >>>> >>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. >>>> >>>> Ready to be installed? >>>> Thanks, >>>> Martin >>>> >>>> gcc/ChangeLog: >>>> >>>> 2019-08-08 Martin Liska >>>> >>>> * value-prof.c (gimple_divmod_fixed_value_transform): >>>> Use dump_printf_loc. >>>> (gimple_mod_pow2_value_transform): Likewise. >>>> (gimple_mod_subtract_transform): Likewise. >>>> (init_node_map): Likewise. >>>> (gimple_ic_transform): Likewise. >>>> (gimple_stringops_transform): Likewise. >>>> >>>> gcc/testsuite/ChangeLog: >>>> >>>> 2019-08-08 Martin Liska >>>> >>>> * g++.dg/tree-prof/indir-call-prof.C: Add -optimize >>>> to -fdump-ipa-profile. >>>> * g++.dg/tree-prof/morefunc.C: Likewise. >>>> * g++.dg/tree-prof/reorder.C: Likewise. >>>> * gcc.dg/tree-prof/ic-misattribution-1.c: Likewise. >>>> * gcc.dg/tree-prof/indir-call-prof.c: Likewise. >>>> * gcc.dg/tree-prof/stringop-1.c: Likewise. >>>> * gcc.dg/tree-prof/stringop-2.c: Likewise. >>>> * gcc.dg/tree-prof/val-prof-1.c: Likewise. >>>> * gcc.dg/tree-prof/val-prof-2.c: Likewise. >>>> * gcc.dg/tree-prof/val-prof-3.c: Likewise. >>>> * gcc.dg/tree-prof/val-prof-4.c: Likewise. >>>> * gcc.dg/tree-prof/val-prof-5.c: Likewise. >>>> * gcc.dg/tree-prof/val-prof-7.c: Likewise. >>>> --- >>>> .../g++.dg/tree-prof/indir-call-prof.C | 2 +- >>>> diff --git a/gcc/value-prof.c b/gcc/value-prof.c >>>> index 759458868a8..9d9785b179d 100644 >>>> --- a/gcc/value-prof.c >>>> +++ b/gcc/value-prof.c >>>> @@ -809,12 +809,9 @@ gimple_divmod_fixed_value_transform (gimple_stmt_iterator *si) >>>> @@ -1445,41 +1447,36 @@ gimple_ic_transform (gimple_stmt_iterator *gsi) >>> [ ... ] >>>> - if (dump_file) >>>> + if (dump_enabled_p ()) >>>> { >>>> - fprintf (dump_file, "Indirect call -> direct call "); >>>> - print_generic_expr (dump_file, gimple_call_fn (stmt), TDF_SLIM); >>>> - fprintf (dump_file, "=> "); >>>> - print_generic_expr (dump_file, direct_call->decl, TDF_SLIM); >>>> - fprintf (dump_file, " transformation on insn postponned to ipa-profile"); >>>> - print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); >>>> - fprintf (dump_file, "hist->count %" PRId64 >>>> - " hist->all %" PRId64"\n", count, all); >>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt, >>>> + "Indirect call -> direct call " >>>> + "%T => %T transformation on insn postponed " >>>> + "to ipa-profile: %G", gimple_call_fn (stmt), >>>> + direct_call->decl, stmt); >>>> + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt, >>>> + "hist->count %" PRId64 >>>> + " hist->all %" PRId64"\n", count, all); >>>> } >>> It's not entirely clear if you want MSG_OPTIMIZED_LOCATION vs >>> MSG_MISSED_OPTIMIZATION here. Double check and adjust if needed. >> But we don't want multi-line stuff here but a single message for >> MSG_OPTIMIZED_LOCATION, eventually detail printed with MSG_NOTE. >> Can you adjust accordingly, esp. try not dumping GIMPLE stmts for >> the non-NOTE message give it is directed at users. So just >> >> Indirect call -> direct call %T -> %T transformation >> >> (without the postponed stuff, that's implementation detail not interesting). > Ok, there's a patch that I've just tested. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed? > Thanks, > Martin > >> Richard. >> >>> OK with or without that adjustment. >>> >>> Jeff > > > 0001-Simplify-dump_printf-in-value-prof.c.patch > > From 4eafa3655a6f557d69c2c41e29634a8c805ea8cc Mon Sep 17 00:00:00 2001 > From: Martin Liska > Date: Fri, 9 Aug 2019 14:34:55 +0200 > Subject: [PATCH] Simplify dump_printf in value-prof.c > > gcc/ChangeLog: > > 2019-08-09 Martin Liska > > * value-prof.c (gimple_ic_transform): Add new line. > Print details with MSG_NOTE. > > gcc/testsuite/ChangeLog: > > 2019-08-09 Martin Liska > > * gcc.dg/tree-prof/ic-misattribution-1.c: Use -fdump-ipa-profile-node. OK jeff