This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add some statistics counting to SRA


Hi,

On Thu, Jun 18, 2009 at 04:25:53PM +0200, Richard Guenther wrote:
> On Thu, 18 Jun 2009, Martin Jambor wrote:
> 
> > Hi,
> > 
> > the  patch below adds  some simple  statistics to  intraprocedural SRA
> > that I  thought might  be useful (and  that I  use to help  me analyze
> > differences  in memory  consumption and  compile time  that  can cause
> > concern).
> > 
> > Bootstrapped and tested on x86_64-linux.  OK for trunk?
> > 
> > Thanks,
> > 
> > Martin
> > 
> > 
> > 2009-06-17  Martin Jambor  <mjambor@suse.cz>
> > 
> > 	* tree-sra.c: Include statistics.h
> > 	(sra_stats): New variable.
> > 	(sra_initialize): Clear sra_stats.
> > 	(create_access_replacement): Increment sra_stats.replacements.
> > 	(get_access_replacement): Do not return twice.
> > 	(analyze_all_variable_accesses): Increment statistics counter by the
> > 	number of scalarized aggregates.
> > 	(generate_subtree_copies): Increment sra_stats.subtree_copies.
> > 	(sra_modify_expr): Increment sra_stats.exprs.
> > 	(load_assign_lhs_subreplacements): Increment sra_stats.subreplacements.
> > 	(sra_modify_assign): Increment sra_stats.exprs,
> > 	sra_stats.separate_lhs_rhs_handling and sra_stats.deleted.
> > 	(perform_intra_sra): Update statistics counters.
> > 	* Makefile.in (tree-sra.o): Add statistics.h to dependencies.
> 
> Why use
> 
> > @@ -1635,7 +1663,13 @@ analyze_all_variable_accesses (void)
> >  	  disqualify_candidate (var, "No scalar replacements to be created.");
> >        }
> >  
> > -  return res;
> > +  if (res)
> > +    {
> > +      statistics_counter_event (cfun, "Scalarized aggregates", res);
> > +      return true;
> > +    }
> > +  else
> > +    return false;
> >  }
> 
> statistics_counter_event here and not a counter in the struct?

This function is run at most once per function (well, actually once in
early SRA  and once for "late" SRA).   So I thought I  would not store
the count just to read it back as it is.  But if you think it's ugly I
can do it, I don't have any strong feelings about this.

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]