From patchwork Tue Sep 3 19:39:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teresa Johnson X-Patchwork-Id: 272383 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 5D2132C00A4 for ; Wed, 4 Sep 2013 05:39:49 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=tb+FvMauvmdM+vOG5z pmff+n5bCApbHsuVy67OEPl5SflQKJzYJpprVAttIA0xaFPO2eJLv32Hq/mLAK2Y Mcd0jS9uLAsEKH+DlhVsjXsv8NumPGlFdG+YKSSRSKf6RfWt1ywm64YW6dQoeQNK RIzuOL4rDGTzf8fu3gvZq6lY8= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=xGDinQP3t5GvVoKHwvNA2FY4 1hc=; b=WRyTYcr1rKRbrnhDPv/QeOuaygE/oqa8pAAS55iqboFqF+DF34t4Gilw xgnDSB1tUIKF34uee/bDUlNcbuS3R417pOJ0WQu7aErIJQC5xFeyKFHtlsFcQtks qc0c3CsVEUfoQnVXqNTbWe7SAc4lpxNTezOKwTRJJ58cyFi6QTk= Received: (qmail 4192 invoked by alias); 3 Sep 2013 19:39:42 -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 4182 invoked by uid 89); 3 Sep 2013 19:39:42 -0000 Received: from mail-qa0-f44.google.com (HELO mail-qa0-f44.google.com) (209.85.216.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 03 Sep 2013 19:39:42 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, NO_RELAYS autolearn=ham version=3.3.2 X-HELO: mail-qa0-f44.google.com Received: by mail-qa0-f44.google.com with SMTP id w8so1530153qac.3 for ; Tue, 03 Sep 2013 12:39:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=K5yB2cdI+oml1Mu9t5sjdxYOT1HBtzVMzaX+nxGC+Fk=; b=igbLj0JsOOL1YbBmlHToN/bzpwBiZGOIr6sAaWDzgQuuFjrEssewYj0zyQehhWYxQf TCfM+d98zKFPE67GIeER2WW46Kgu7nEj/OjH0Vs3G4pjsDAhNJSc9AeIi6o8gdmL8djZ oJdhjIDh2FoRor2yLKJhwxwne8FnyKFe+TwsHe9s7kJsa2hZf/XwPlBPwXAi8VTD0mJk 7YQWQGWKn8Am8K8+7rRPAdDJJRCtRoVmKu+DmyBtIDOiSPwiHX3ASOdZ7XXCAmCExn6j NhN4RJyQmi+Yf0Sy8gd0Wb4+5DnQyFszKosA08Uw9VJ4Kd2ZkFeSPl48dvvgWkEkTfo/ ir3Q== X-Gm-Message-State: ALoCoQlSbr8LGBCkflxtPZKiamsUxzIJ+JxocNgJWSGpNNRc9dh6AnYJPpAPobtznzSilfq7QDOxW7lZv74HxJw/gy1UGGecP9msQ6lOAja6HHwR+fWrMansI1Qsg6NPQUoeB82cJBWFysbnCSFkvBZshrvoXxyG0FfQLjQoVkZpebnpBQEZczq2O425G4ecoCbIO+TbDQxEcjspayPi/NB4Hev7rXJhgA== MIME-Version: 1.0 X-Received: by 10.49.107.105 with SMTP id hb9mr13892993qeb.74.1378237178994; Tue, 03 Sep 2013 12:39:38 -0700 (PDT) Received: by 10.49.24.225 with HTTP; Tue, 3 Sep 2013 12:39:38 -0700 (PDT) In-Reply-To: References: <20130806123714.GD3166@virgil.suse> <20130806160102.GE3166@virgil.suse> Date: Tue, 3 Sep 2013 12:39:38 -0700 Message-ID: Subject: Re: [PATCH] Convert more passes to new dump framework From: Teresa Johnson To: Sharad Singhai Cc: Xinliang David Li , Richard Biener , "gcc-patches@gcc.gnu.org" , Dehao Chen X-IsSubscribed: yes On Fri, Aug 30, 2013 at 11:28 PM, Sharad Singhai wrote: >> Found the issue. The stream was incorrectly being closed when it was >> stderr/stdout. So only the dump output before the first dump_finish >> call was being emitted to stderr. I fixed this the same way the >> alt_dump_file was being handled just below - don't close if it is >> stderr/stdout. Confirmed that this fixes the problem. >> >> (So the real ratio between the volume of -fdump-...=stderr and >> -fopt-info is much higher than what I reported in an earlier email) >> >> Is the following patch ok, pending regression tests? >> >> 2013-08-30 Teresa Johnson >> >> * dumpfile.c (dump_finish): Don't close stderr/stdout. >> >> Index: dumpfile.c >> =================================================================== >> --- dumpfile.c (revision 202059) >> +++ dumpfile.c (working copy) >> @@ -450,7 +450,8 @@ dump_finish (int phase) >> if (phase < 0) >> return; >> dfi = get_dump_file_info (phase); >> - if (dfi->pstream) >> + if (dfi->pstream && strcmp("stderr", dfi->pfilename) != 0 >> + && strcmp("stdout", dfi->pfilename) != 0) >> fclose (dfi->pstream); >> >> if (dfi->alt_stream && strcmp("stderr", dfi->alt_filename) != 0 > > Yes, this is clearly a bug which I missed. Thanks for fixing it. Is it > feasible to add a test case for it? > > Thanks, > Sharad Good idea. I modified an existing test to dump to stderr instead of a dump file. Since it has 2 functions with messages from each, I confirmed that it exposed the bug. Here is the full patch. Bootstrapped and tested on x86_64-unknown-linux-gnu. Ok for trunk? Thanks, Teresa 2013-09-03 Teresa Johnson * dumpfile.c (dump_finish): Don't close stderr/stdout. * testsuite/gcc.dg/unroll_1.c: Test dumping to stderr. } @@ -21,12 +21,10 @@ int foo(void) int foo2(void) { int i; - for (i = 0; i < 2; i++) + for (i = 0; i < 2; i++) /* { dg-message "note: loop turned into non-loop; it never loops" } */ { a[i]= b[i] + 1; } return 1; } - -/* { dg-final { scan-rtl-dump-times "loop turned into non-loop; it never loops" 2 "loop2_unroll" } } */ -/* { dg-final { cleanup-rtl-dump "loop2_unroll" } } */ +/* { dg-prune-output ".*" } */ Index: dumpfile.c =================================================================== --- dumpfile.c (revision 202121) +++ dumpfile.c (working copy) @@ -450,7 +450,9 @@ dump_finish (int phase) if (phase < 0) return; dfi = get_dump_file_info (phase); - if (dfi->pstream) + if (dfi->pstream && (!dfi->pfilename + || (strcmp("stderr", dfi->pfilename) != 0 + && strcmp("stdout", dfi->pfilename) != 0))) fclose (dfi->pstream); if (dfi->alt_stream && strcmp("stderr", dfi->alt_filename) != 0 Index: testsuite/gcc.dg/unroll_1.c =================================================================== --- testsuite/gcc.dg/unroll_1.c (revision 202121) +++ testsuite/gcc.dg/unroll_1.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-rtl-loop2_unroll -fno-peel-loops -fdisable-tree-cunroll -fdisable-tree-cunrolli -fenable-rtl-loop2_unroll" } */ +/* { dg-options "-O2 -fdump-rtl-loop2_unroll=stderr -fno-peel-loops -fdisable-tree-cunroll -fdisable-tree-cunrolli -fenable-rtl-loop2_unroll" } */ unsigned a[100], b[100]; inline void bar() @@ -11,7 +11,7 @@ int foo(void) { int i; bar(); - for (i = 0; i < 2; i++) + for (i = 0; i < 2; i++) /* { dg-message "note: loop turned into non-loop; it never loops" } */ { a[i]= b[i] + 1;