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]

Compile-time speedup and reduce memory usage


This is something I happened to notice while working on an unrelated
issue.  Since these changes stand alone I decided to go ahead and push
them out now.


rewrite_ssa_into_ssa uses SSA_NAME_AUX structures to effectively provide
annotations for SSA_NAMEs.  The first thing to realize that if an
SSA_NAME is not being rewritten, then we do not need an SSA_NAME_AUX
structure for that SSA_NAME.

Unfortunately, ssa_rewrite_initialize_block calls ssa_register_new_def,
even when the target SSA_NAME is not marked for rewriting.  This is
a waste of time.

Once that little botch is fixed we can perform a couple cleanups
in rewrite_ssa_into_ssa.

  1. We only need to initialize the current definition for SSA_NAMEs
  which are being rewritten, rather than all of them.  We're able to
  change a walk over all the SSA_NAMEs, to a walk over the set of
  SSA_NAMEs that we are rewriting.  Plus we avoid allocating all
  those useless SSA_NAME_AUX structures.

  2. We only need to free SSA_NAME_AUX for SSA_NAMEs which are being
  rewritten.  So again, we can walk over just the set of SSA_NAMEs
  which are being rewritten rather than all of them.


Basically rewrite_ssa_into_ssa and its children are mucking around
with SSA_NAME_AUX for SSA_NAMEs which are not being renamed and burning
a surprising amount of time in the process.

In my slightly hacked up tree which hits rewrite_ssa_into_ssa
harder than mainline we get a nice 3% speedup for the components of
cc1 test.  I would expect mainline to see a smaller improvement, 
probably on the order of 0.5% to 1.5%.

Bootstrapped and regression tested on i686-pc-linux-gnu.


Attachment: PPP
Description: Text document


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