This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Value profile based optimizations, part 1
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, nathan at codesourcery dot com, rth at redhat dot com
- Date: Tue, 10 Jun 2003 00:42:06 +0200
- Subject: Re: [PATCH] Value profile based optimizations, part 1
- References: <20030426220941.GA14611@atrey.karlin.mff.cuni.cz> <3EABD519.10607@codesourcery.com> <20030427163514.GA5895@atrey.karlin.mff.cuni.cz> <3EAE8A13.8010109@codesourcery.com> <20030429153741.GA20897@atrey.karlin.mff.cuni.cz> <3EB3BA9E.4070106@codesourcery.com> <20030503215839.GA7007@atrey.karlin.mff.cuni.cz> <3EB51BF4.6030706@codesourcery.com> <20030608204856.GA23446@atrey.karlin.mff.cuni.cz> <20030609221612.GC25519@kam.mff.cuni.cz>
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