new ira optimization - adding a loop to ira

stefan@franke.ms stefan@franke.ms
Fri Sep 13 08:48:00 GMT 2019


I'm working on a new optimization to get rid of spilled tmp variables (e.g.
introduced by pre) to use the source mem ref instead of a stack slot.

To do this, I added a loop into ira.c:ira()

  init_prune_stack_vars ();
  do
    {
#ifndef IRA_NO_OBSTACK
  gcc_obstack_init (&ira_obstack);
#endif
bitmap_obstack_initialize (&ira_bitmap_obstack);

...

      ira_color ();

    }
  while (flag_prune_stack_vars && prune_stack_vars ());

To get it work, the prune_stack_vars function resets a couple of data.
This is mostly working - but on some source files, it fails due to invalid
reg_equivs. 
Since this also happens, if the optimizer does nothing and just loops once.

Currently I'm calling this, before looping again

      regstat_free_n_sets_and_refs ();
      regstat_free_ri ();
      loop_optimizer_finalize ();
      free_dominance_info (CDI_DOMINATORS);

Any hint, what I'm missing to reset?




More information about the Gcc-help mailing list