From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75019 invoked by alias); 28 Jul 2017 07:50:14 -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 75000 invoked by uid 89); 28 Jul 2017 07:50:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Jul 2017 07:50:11 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2C072AC05; Fri, 28 Jul 2017 07:50:09 +0000 (UTC) Subject: Re: [PATCH] Dump BB number when dumping a BB with label. To: Richard Biener Cc: GCC Patches , Jan Hubicka References: <09f05b6e-99bd-0238-e39b-185c5df95fe5@suse.cz> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: <58bcd15e-621b-662d-7466-05bca1270730@suse.cz> Date: Fri, 28 Jul 2017 07:50:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg01882.txt.bz2 On 07/28/2017 09:21 AM, Richard Biener wrote: > On Thu, Jul 27, 2017 at 4:24 PM, Martin Liška wrote: >> Hi. >> >> Following simple patch adds support for dumping of BBs when it's a BB >> that contains a label. That makes it easier for debugging as one can >> find destination for an edge in dump file. >> >> Sample, before: >> >> foo (int a) >> { >> int D.1821; >> int _1; >> int _4; >> int _5; >> >> [0.00%] [count: INV]: >> switch (a_2(D)) [INV] [count: INV], case 0: [INV] [count: INV], case 1: [INV] [count: INV]> >> >> [0.00%] [count: INV]: >> a_3 = a_2(D) + 2; >> >> [0.00%] [count: INV]: >> _4 = 2; >> goto (); [INV] [count: INV] >> >> [0.00%] [count: INV]: >> _5 = 123; >> >> # _1 = PHI <_4(4), _5(5)> >> [0.00%] [count: INV]: >> return _1; >> >> } >> >> After: >> >> foo (int a) >> { >> int D.1821; >> int _1; >> int _4; >> int _5; >> >> [0.00%] [count: INV]: >> switch (a_2(D)) [INV] [count: INV], case 0: [INV] [count: INV], case 1: [INV] [count: INV]> >> >> () [0.00%] [count: INV]: >> a_3 = a_2(D) + 2; >> >> () [0.00%] [count: INV]: >> _4 = 2; >> goto (); [INV] [count: INV] >> >> () [0.00%] [count: INV]: >> _5 = 123; >> >> # _1 = PHI <_4(4), _5(5)> >> () [0.00%] [count: INV]: >> return _1; >> >> } >> >> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. >> >> Thoughts? > > I think I prefer to always see > > ....: > > and if there's a label just dump that as well, thus > > ....: > L0: > > I think that's how we dump the case with multiple labels. And always use the > implicit bb N when dumping destinations (in gotos, switches, etc). > > That is, what we have now is IMHO premature prettifying losing BB > indices in the dumps > unnecessarily. > > Richard. Hi. I like your ideas, there's difference in between 7.1 and modified trunk: foo (int a) { int D.1824; int _1; int _4; int _6; [0.00%] [count: INV]: switch (a_2(D)) [INV] [count: INV], case 0: [INV] [count: INV], case 1: [INV] [count: INV]> [0.00%] [count: INV]: a_3 = a_2(D) + 2; [0.00%] [count: INV]: _4 = 2; goto (); [INV] [count: INV] [0.00%] [count: INV]: [0.00%] [count: INV]: a_5 = a_2(D) + 2; label_XXX [0.00%] [count: INV]: label_YYY [0.00%] [count: INV]: _6 = 101; # _1 = PHI <_4(4), _6(7)> [0.00%] [count: INV]: return _1; } after: foo (int a) { int D.1824; int _1; int _4; int _6; [0.00%] [count: INV]: switch (a_2(D)) [INV] [count: INV], case 0: [INV] [count: INV], case 1: [INV] [count: INV]> [0.00%] [count: INV]: : a_3 = a_2(D) + 2; [0.00%] [count: INV]: : _4 = 2; goto ; [INV] [count: INV] [0.00%] [count: INV]: : [0.00%] [count: INV]: a_5 = a_2(D) + 2; [0.00%] [count: INV]: label_XXX: label_YYY: _6 = 101; [0.00%] [count: INV]: # _1 = PHI <_4(4), _6(7)> : return _1; } Do you like it? What about indentation of labels, should I increase it or leave it? I guess there will be some tests that will need to be adjusted. Martin > >> Martin >> >> gcc/testsuite/ChangeLog: >> >> 2017-07-27 Martin Liska >> >> * gcc.dg/builtin-unreachable-6.c: Update scanned pattern. >> * gcc.dg/tree-ssa/attr-hotcold-2.c: Likewise. >> * gcc.dg/tree-ssa/ssa-ccp-18.c: Likewise. >> >> gcc/ChangeLog: >> >> 2017-07-27 Martin Liska >> >> * gimple-pretty-print.c (dump_gimple_label): Dump BB number. >> --- >> gcc/gimple-pretty-print.c | 6 +++++- >> gcc/testsuite/gcc.dg/builtin-unreachable-6.c | 2 +- >> gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c | 4 ++-- >> gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-18.c | 3 +-- >> 4 files changed, 9 insertions(+), 6 deletions(-) >> >>