Patchwork Convert more passes to new dump framework

login
register
mail settings
Submitter Teresa Johnson
Date Aug. 31, 2013, 4:58 a.m.
Message ID <CAAe5K+VCACkkDkCKSpJ4ougc7bO5=Jc=wQhRD0L_aZcc=Z+_qw@mail.gmail.com>
Download mbox | patch
Permalink /patch/271507/
State New
Headers show

Comments

Teresa Johnson - Aug. 31, 2013, 4:58 a.m.
>>>> Besides, we might also want to
>>>> use the same machinery (dump_printf_loc etc) for dump file dumping.
>>>> The current behavior of using '-details' to turn on opt-info-all
>>>> messages for dump files are not desirable.
>>>
>>> Interestingly, this doesn't even work. When I do
>>> -fdump-ipa-inline-details=stderr (with my patch containing the inliner
>>> messages) I am not getting those inliner messages emitted to stderr.
>>> Even though in dumpfile.c "details" is set to (TDF_DETAILS |
>>> MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION | MSG_NOTE). I'm not
>>> sure why, but will need to debug this.
>>
>> It works for vectorizer pass.
>
> Ok, let me see what is going on - I just confirmed that it is not
> working for the loop unroller messages either.
>

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.



Thanks,
Teresa
Sharad Singhai - Aug. 31, 2013, 6:28 a.m.
On Fri, Aug 30, 2013 at 9:58 PM, Teresa Johnson <tejohnson@google.com> wrote:
>>>>> Besides, we might also want to
>>>>> use the same machinery (dump_printf_loc etc) for dump file dumping.
>>>>> The current behavior of using '-details' to turn on opt-info-all
>>>>> messages for dump files are not desirable.
>>>>
>>>> Interestingly, this doesn't even work. When I do
>>>> -fdump-ipa-inline-details=stderr (with my patch containing the inliner
>>>> messages) I am not getting those inliner messages emitted to stderr.
>>>> Even though in dumpfile.c "details" is set to (TDF_DETAILS |
>>>> MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION | MSG_NOTE). I'm not
>>>> sure why, but will need to debug this.
>>>
>>> It works for vectorizer pass.
>>
>> Ok, let me see what is going on - I just confirmed that it is not
>> working for the loop unroller messages either.
>>
>
> 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

> Thanks,
> Teresa

Patch

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