This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Convert more passes to new dump framework
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Teresa Johnson <tejohnson at google dot com>
- Cc: Sharad Singhai <singhai at google dot com>, Xinliang David Li <davidxl at google dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Dehao Chen <dehao at google dot com>
- Date: Wed, 4 Sep 2013 10:23:02 +0200
- Subject: Re: [PATCH] Convert more passes to new dump framework
- Authentication-results: sourceware.org; auth=none
- References: <CAAe5K+W=brFLz3kZYFXTYAE+T2yJVPF=z+vp+uKh4d+9vQXJKQ at mail dot gmail dot com> <20130806123714 dot GD3166 at virgil dot suse> <CAAe5K+VSDkg5sKB2nvraHFv66ZKGO84W6obYj+sBfGZ7F3-hpw at mail dot gmail dot com> <20130806160102 dot GE3166 at virgil dot suse> <CAAe5K+VCwEUz1BWAnAvPrSBT3DHsu1P-eF4-nQb9+aFyDyRORw at mail dot gmail dot com> <CAAe5K+Vu0en=WFJp5bw-Vu=n05LYGxvmmfctnZSWeS-5PKT=Rg at mail dot gmail dot com> <CAFiYyc17odz-dL10BcNcKc8B_QNE2KB538dunz45=1Kn67d-gw at mail dot gmail dot com> <CAAe5K+W2rXph_7YkB1DgyXK55s4XQVtV+yvGY3q30-1DEkSK7A at mail dot gmail dot com> <CAFiYyc1DUmGZ1qeBL8mKRGy_1bd1whTW_XmmkOc-PU4WmGMoEg at mail dot gmail dot com> <CAAe5K+WBuaShbbA_hre_LK90NoShJ8yCRF0NLLnGcoQuZ6P-Nw at mail dot gmail dot com> <CAFiYyc2GNvLbsuWeBAsXHTt1kBY_ksDeXN0Spb9XwhuYd4MP0w at mail dot gmail dot com> <CAAkRFZLGvTPzFFLMif1Qw+1w8uUDa7mA00Ur7YOvLSFYTDp84w at mail dot gmail dot com> <CAAe5K+XjXYMMSJBy_W8B-ccZ8GddAnJXnUonzQzegCJzE3XGgA at mail dot gmail dot com> <CAAkRFZKumZHfyS8KFhDvB9PCfrY6ZLoOwP14SJbz5UcCSm-TXQ at mail dot gmail dot com> <CAAe5K+XsbF4hkyWHrNRoAZyMsXzEwgA_SpnckmAaLgMhLg8Rdg at mail dot gmail dot com> <CAAe5K+VCACkkDkCKSpJ4ougc7bO5=Jc=wQhRD0L_aZcc=Z+_qw at mail dot gmail dot com> <CAKxPW67GavJeu1XFz7CtWxRL21x1Bk57aK4rS+mf+s-YiYEUxA at mail dot gmail dot com> <CAAe5K+WZ11YmjWGqAjjryqhLFNDgNKmBwo5ZzZoYg0=MLYZOOg at mail dot gmail dot com>
On Tue, Sep 3, 2013 at 9:39 PM, Teresa Johnson <tejohnson@google.com> wrote:
> On Fri, Aug 30, 2013 at 11:28 PM, Sharad Singhai <singhai@google.com> 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 <tejohnson@google.com>
>>>
>>> * 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?
Ok.
Thanks,
Richard.
> Thanks,
> Teresa
>
> 2013-09-03 Teresa Johnson <tejohnson@google.com>
>
> * dumpfile.c (dump_finish): Don't close stderr/stdout.
>
> * testsuite/gcc.dg/unroll_1.c: Test dumping to stderr.
>
> 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;
> }
> @@ -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 ".*" } */
>
>
> --
> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413