Message ID | AANLkTim6Nr1Bl53YjTxip7UgURrv5Vep7qsqxNOuhmIz@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Thu, Jun 10, 2010 at 04:23:07PM -0700, H.J. Lu wrote: > We have > > > if (!df_live_scratch) > - df_live_scratch = BITMAP_ALLOC (NULL); > + df_live_scratch = BITMAP_ALLOC (&problem_data->live_bitmaps); > ... > + bitmap_obstack_release (&problem_data->live_bitmaps); > > if (df_live_scratch) > BITMAP_FREE (df_live_scratch); > > We are calling bitmap_obstack_free after bitmap_obstack_release is called. Does > this patch make any senses? > > > Index: df-problems.c > =================================================================== > --- df-problems.c (revision 160549) > +++ df-problems.c (working copy) > @@ -1645,8 +1645,8 @@ df_live_free (void) > free (df_live->block_info); > bitmap_obstack_release (&problem_data->live_bitmaps); > > - if (df_live_scratch) > - BITMAP_FREE (df_live_scratch); > + /* df_live_scratch is allocated from problem_data->live_bitmaps. */ > + df_live_scratch = (bitmap) NULL; Wouldn't it be better to move that if (df_live_scratch) BITMAP_FREE (df_live_scratch); before bitmap_obstack_release? BITMAP_FREE is pretty cheap operation and if you don't do it, the statistics won't be updated. Jakub
>> Index: df-problems.c >> =================================================================== >> --- df-problems.c (revision 160549) >> +++ df-problems.c (working copy) >> @@ -1645,8 +1645,8 @@ df_live_free (void) >> free (df_live->block_info); >> bitmap_obstack_release (&problem_data->live_bitmaps); >> >> - if (df_live_scratch) >> - BITMAP_FREE (df_live_scratch); >> + /* df_live_scratch is allocated from problem_data->live_bitmaps. */ >> + df_live_scratch = (bitmap) NULL; > > Wouldn't it be better to move that > if (df_live_scratch) > BITMAP_FREE (df_live_scratch); > before bitmap_obstack_release? BITMAP_FREE is pretty cheap operation > and if you don't do it, the statistics won't be updated. Yes. Both patches make sense, but Jakub's is better. Paolo
Index: df-problems.c =================================================================== --- df-problems.c (revision 160549) +++ df-problems.c (working copy) @@ -1645,8 +1645,8 @@ df_live_free (void) free (df_live->block_info); bitmap_obstack_release (&problem_data->live_bitmaps); - if (df_live_scratch) - BITMAP_FREE (df_live_scratch); + /* df_live_scratch is allocated from problem_data->live_bitmaps. */ + df_live_scratch = (bitmap) NULL; } BITMAP_FREE (df_live->out_of_date_transfer_functions); free (df_live);