edge profiling code clobbers regs

Jan Hubicka jh@suse.cz
Tue Oct 5 14:27:00 GMT 2004

> Hello Jan,
> on S/390 I would like to enable memcmp code which needs condition codes to be live
> over bb boundaries. Unfortunately the edge profiler doesn't care about liveness of registers.
> On S/390 it is especially important that he does because we have no add instruction which
> doesn't clobber the condition code, hence profiling code always clobbers cc. 
> I've tried to simply replace insert_insn_on_edge with safe_insert_insn_on_edge in rtl_gen_edge_profiler 
> but unfortunately no liveness data have been computed at this point. I found that for the newer value 
> profiler the liveness analysis is done in rtl_find_values_to_profile but didn't found a clever place to 
> do so for the edge profiler.
> Jan, could you please have a look at this or give me a hint how to fix it on my own?

The ultimate goal is to move away from RTL based edge profiler to tree
based one (you get it enabled with -ftree-profiling) but we are not 100%
there yet - we need to kill old loop optimizer and we need to
re-implement value profiler on trees.

In the case you find this important for 4.0, I would propose simply
moving the liveness computation into branch_prob after cfg is extended
by fake edges and before the profiling code is inserted. THat should
make it possible to use liveness for both passes (I am not quite
convinced tought that it will get updated by edge splitting code,
perhaps you will need local update of life info before value profiling).

I don't think the slowdown is critical as profiling takes time too, so
we can discuss this with Richard but I think it will work for 4.0

> Bye,
> -Andreas-

More information about the Gcc mailing list