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] Value profile based optimizations, part 1


Hello,

> > + /* Add code to measure histograms list of VALUES of length N_VALUES.  */
> > + static void
> > + instrument_values (unsigned n_values, struct histogram_value *values)
> > + {
> > +   rtx sequence;
> > +   unsigned i, t;
> > +   edge e;
> > +  
> > +   /* Emit code to generate the histograms before the insns.  */
> > + 
> > +   for (i = 0; i < n_values; i++)
> > +     {
> > +       e = split_block (BLOCK_FOR_INSN (values[i].insn),
> > + 		       PREV_INSN (values[i].insn));
> ..
> > + 
> > +       insert_insn_on_edge (sequence, e);
> 
> This looks unsafe to me.  The newly produced code can do nasty things 
> (especially clobbering flags).  At the moment we do have number of
> places in compiler that do assume that flags are dead at BB boundaries
> and few other places in compiler that breaks this expectation.  I think
> we should at least make it no worse.

you're of course right, but ...

> One way to do so without liveness information I can think of is to
> emit just copy instruction at the specified place and put the complex
> code to the exit edges from the basic block...

... this really does not look as a good way to me.  It would force us to
do not do the profiling in many cases from not really a good reason
(when there is a computed goto at the end of block, or any non-flow
edge). Also it would make the profiling code about twice as large.
Note that I need liveness for one of vpt optimizations anyway,
so we could use it.  Also I don't think that compiler performance is
a problem here, as someone caring for it will hardly do a compilation
with profile feedback and vpt enabled.

Zdenek


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