More cleanups for CFG dumping

Submitted by Steven Bosscher on July 20, 2012, 9:02 a.m.

Details

Message ID CABu31nMLt9+DtY4s_7-L_+m8hp8=6s_EQh+K65LKpmK1_Xw4-Q@mail.gmail.com
State New
Headers show

Commit Message

Steven Bosscher July 20, 2012, 9:02 a.m.
On Thu, Jul 19, 2012 at 11:09 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> Hmm, pp_flush looks like a lot more expensive compared to pp_newline
> for example in
>
> @@ -74,7 +74,7 @@ maybe_init_pretty_print (FILE *file)
>  static void
>  newline_and_indent (pretty_printer *buffer, int spc)
>  {
> -  pp_newline (buffer);
> +  pp_flush (buffer);
>    INDENT (spc);
>  }
>
> And I'm pretty sure that newline_and_indent callers that after it directly
> dump to the stream should be fixed instead.  In fact, constant flushing
> will just make things slow (yes, it's only dumping ...).

Right, it's only dumping. I'm surprised one would care about its
performance. And the patch actually helps in the debugger also: if for
some reason a piece of invalid gimple is encountered then at least the
part that was OK is still dumped. But oh well :-)

I will need this additional patch to avoid test suite failures:

I suppose that's OK?

Ciao!
Steven

Comments

Richard Guenther July 20, 2012, 9:28 a.m.
On Fri, Jul 20, 2012 at 11:02 AM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Thu, Jul 19, 2012 at 11:09 AM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> Hmm, pp_flush looks like a lot more expensive compared to pp_newline
>> for example in
>>
>> @@ -74,7 +74,7 @@ maybe_init_pretty_print (FILE *file)
>>  static void
>>  newline_and_indent (pretty_printer *buffer, int spc)
>>  {
>> -  pp_newline (buffer);
>> +  pp_flush (buffer);
>>    INDENT (spc);
>>  }
>>
>> And I'm pretty sure that newline_and_indent callers that after it directly
>> dump to the stream should be fixed instead.  In fact, constant flushing
>> will just make things slow (yes, it's only dumping ...).
>
> Right, it's only dumping. I'm surprised one would care about its
> performance. And the patch actually helps in the debugger also: if for
> some reason a piece of invalid gimple is encountered then at least the
> part that was OK is still dumped. But oh well :-)
>
> I will need this additional patch to avoid test suite failures:
>
> Index: pretty-print.c
> ===================================================================
> --- pretty-print.c      (revision 189705)
> +++ pretty-print.c      (working copy)
> @@ -759,6 +759,7 @@ void
>  pp_base_newline (pretty_printer *pp)
>  {
>    obstack_1grow (pp->buffer->obstack, '\n');
> +  pp_needs_newline (pp) = false;
>    pp->buffer->line_length = 0;
>  }
>
> I suppose that's OK?

Yes.

Thanks,
Richard.

> Ciao!
> Steven

Patch hide | download patch | download mbox

Index: pretty-print.c
===================================================================
--- pretty-print.c      (revision 189705)
+++ pretty-print.c      (working copy)
@@ -759,6 +759,7 @@  void
 pp_base_newline (pretty_printer *pp)
 {
   obstack_1grow (pp->buffer->obstack, '\n');
+  pp_needs_newline (pp) = false;
   pp->buffer->line_length = 0;
 }