Message ID | alpine.LNX.2.00.1302201357090.3543@zhemvz.fhfr.qr |
---|---|
State | New |
Headers | show |
>> Hunting for the "we're getting slower" bits I noticed that >> TODO_remove_unused_locals is a big part of execute_function_todo >> (and accounts for 1% of compile-time of ac.f90). >> The following patch removes most of the remove_unused_locals >> calls based on the fact that with anonymous SSA names now available >> we should never create new locals (wishful thinking of course ...) We still can kill references to existing ones. >> and the important places to remove unused stuff are driven by >> 1) avoid creating yet another copy of the unused stuff, thus do >> it before inlining, on the callee; 2) avoid pinning unused memory >> while we operate on other function bodies, thus, do it at the end >> of non-IPA pass pipelines >> >> In the end this asks for more explicit placement and thus a >> real pass ... but the following should be enough as a RFC and >> be good enough for 4.8. Yes, it looks good to me. I introduced this remove_unused_locals stuff and I was aware it is executed quite too often. I meant to get some data on this but never got around that and moreover the number of execution has increased over the years as we increased number of passes... My recollection is that at that time the pass also did dropping of some flags (ADDRESSABLE?) promoting into Gimple registers. This was motivation to keep it working often since it was code quality thing too. I suppose this is now done elsewhere. Honza
On Thu, 21 Feb 2013, Jan Hubicka wrote: > > > > Hunting for the "we're getting slower" bits I noticed that > > > TODO_remove_unused_locals is a big part of execute_function_todo > > > (and accounts for 1% of compile-time of ac.f90). > > > The following patch removes most of the remove_unused_locals > > > calls based on the fact that with anonymous SSA names now available > > > we should never create new locals (wishful thinking of course ...) > > We still can kill references to existing ones. > > > > and the important places to remove unused stuff are driven by > > > 1) avoid creating yet another copy of the unused stuff, thus do > > > it before inlining, on the callee; 2) avoid pinning unused memory > > > while we operate on other function bodies, thus, do it at the end > > > of non-IPA pass pipelines > > > > > > In the end this asks for more explicit placement and thus a > > > real pass ... but the following should be enough as a RFC and > > > be good enough for 4.8. > > Yes, it looks good to me. I introduced this remove_unused_locals stuff > and I was aware it is executed quite too often. I meant to get some data on > this > but never got around that and moreover the number of execution has increased > over the years as we increased number of passes... > > My recollection is that at that time the pass also did dropping of some flags > (ADDRESSABLE?) promoting into Gimple registers. This was motivation to keep > it working often since it was code quality thing too. I suppose this is now > done elsewhere. Yes, that's done with TODO_update_address_taken which is done in a more controlled fashion. Richard.
Index: gcc/tree-ssa-live.c =================================================================== --- gcc/tree-ssa-live.c (revision 196170) +++ gcc/tree-ssa-live.c (working copy) @@ -889,7 +889,10 @@ remove_unused_locals (void) dstidx++; } if (dstidx != num) - cfun->local_decls->truncate (dstidx); + { + statistics_counter_event (cfun, "unused VAR_DECLs removed", num - dstidx); + cfun->local_decls->truncate (dstidx); + } remove_unused_scope_block_p (DECL_INITIAL (current_function_decl));