From patchwork Fri Mar 18 09:35:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 599385 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qRKqJ1lLLz9sds for ; Fri, 18 Mar 2016 20:36:28 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=GpOIPxHz; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=jRaw0MktMwkuwOfqs Sa8N3DgfwSYhwpiWjhyN77LASJN3jHYZbaWCwsqor2fmKcDZq+o5NXnzK46hRj90 RTLlIMXLK0Llqb0ZsCHUgFtQIa41akngDmavH7MfP86fg/c5FO2DMO4FVmB012vD GdXV/to9M6f0gufrUKFFpCTe/I= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=mqqRn+QSXsAi+uDxNN+H+oH cQnI=; b=GpOIPxHz20YP/8e7Lm9YzaVGFJjbki57fLL2UA4sV9oyzLB7p2p8uMj GB29uOPfPOM5ex6oKKTpuNbQmUN1yYdj0Nbtm4im9vb8zE4JZLagIj/wAMcNJ5VC ktIEp4Omz8EdZvRpd4bFg6X4QKn8/wIGbHQdu6LyEURH8Ah66ZDE= Received: (qmail 83886 invoked by alias); 18 Mar 2016 09:36:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 83873 invoked by uid 89); 18 Mar 2016 09:36:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=atm, 2016-03-18 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 18 Mar 2016 09:36:17 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1agqpL-0004vz-C8 from Tom_deVries@mentor.com ; Fri, 18 Mar 2016 02:36:15 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Fri, 18 Mar 2016 09:36:13 +0000 Subject: Re: [PATCH, PR70161] Fix fdump-ipa-all-graph To: Richard Biener References: <56E6D97F.3030606@mentor.com> <56EBC8F6.4010704@mentor.com> CC: GCC Patches , Jan Hubicka From: Tom de Vries Message-ID: <56EBCBF5.8060302@mentor.com> Date: Fri, 18 Mar 2016 10:35:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <56EBC8F6.4010704@mentor.com> On 18/03/16 10:23, Tom de Vries wrote: > On 15/03/16 12:37, Richard Biener wrote: >> On Mon, 14 Mar 2016, Tom de Vries wrote: >> >>> Hi, >>> >>> this patch fixes PR70161, a 4.9/5/6 regression. >>> >>> Currently when using -fdump-ipa-all-graph, the compiler ICEs in >>> execute_function_dump when testing for pass->graph_dump_initialized, >>> because >>> pass == NULL. >>> >>> The patch fixes: >>> - the ICE by setting the pass argument in the call to >>> execute_function_dump in execute_one_ipa_transform_pass >>> - a subsequent ICE (triggered with -fipa-pta) by saving, resetting and >>> restoring dump_file_name in cgraph_node::get_body, alongside the >>> saving and restoring of the dump_file variable. >>> - the duplicate edges in the subsequently generated dot file by >>> ensuring that execute_function_dump is called only once per function >>> per pass. [ Note that this bit also has an effect for the normal dump >>> files for the ipa passes with transform function. For those >>> functions, >>> atm execute_function_dump is called both after execute and after >>> transform. With the patch, it's only called after transform. ] >>> >>> Bootstrapped and reg-tested on x86_64. >>> >>> OK for stage4? >> >> Ok. >> > > I've added these two test-cases that test the first two fixes. > > Committed to trunk as obvious. > This patch adds testing for the last fix. In order to make scanning lines in a .dot file work, I needed a fix in dump-suffix to show cp.dot and inline.dot in the test summary: ... PASS: gcc.dg/pr70161.c scan-ipa-dump-times cp.dot "subgraph" 1 PASS: gcc.dg/pr70161.c scan-ipa-dump-times inline.dot "subgraph" 1 ... Otherwise it would just show 'dot'. Bootstrapped and reg-tested on x86_64. OK for stage4 trunk, 4.9/5 release branches? Thanks, - Tom Add dot-file scans to pr70161.c 2016-03-18 Tom de Vries * gcc.dg/pr70161.c: Add dot-file scans. * lib/scandump.exp (dump-suffix): Return suffix after first dot char, instead of after last dot char. --- gcc/testsuite/gcc.dg/pr70161.c | 3 +++ gcc/testsuite/lib/scandump.exp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/pr70161.c b/gcc/testsuite/gcc.dg/pr70161.c index 0b173c7..9b77d90 100644 --- a/gcc/testsuite/gcc.dg/pr70161.c +++ b/gcc/testsuite/gcc.dg/pr70161.c @@ -5,3 +5,6 @@ void foo (void) { } + +/* { dg-final { scan-ipa-dump-times "subgraph" 1 "inline.dot" } } */ +/* { dg-final { scan-ipa-dump-times "subgraph" 1 "cp.dot" } } */ diff --git a/gcc/testsuite/lib/scandump.exp b/gcc/testsuite/lib/scandump.exp index 74d27cc..89b3944 100644 --- a/gcc/testsuite/lib/scandump.exp +++ b/gcc/testsuite/lib/scandump.exp @@ -22,7 +22,7 @@ # Extract the constant part of the dump file suffix from the regexp. # Argument 0 is the regular expression. proc dump-suffix { arg } { - set idx [expr [string last "." $arg] + 1] + set idx [expr [string first "." $arg] + 1] return [string range $arg $idx end] }