[patch] for optimization/12440

Geoff Keating geoffk@geoffk.org
Sat Jan 17 09:50:00 GMT 2004


Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> writes:

> Hello,
> 
> loop optimizer keeps allocating trash due to expression simplification,
> which leads to huge amount of memory consumed in case there is a lot of
> loops in the function.  This patch fixes it by running garbage collector
> after each loop is optimized.
> 
> Bootstrapped & regtested on i686.

Is it really safe to call ggc_collect here?  Look at all the stuff
that's freed after this:

  end_alias_analysis ();

  /* Clean up.  */
  for (i = 0; i < (int) loops->num; i++)
    free (loops_info[i].mems);

  free (uid_luid);
  free (uid_loop);
  free (loops_info);
  free (loops->array);

Are you sure none of that will contain the only reference to some GCed
item (like a rtx)?

Also, you should bootstrap & test with gcac checking.

>         struct loop *loop = &loops->array[i];
>   
>         if (! loop->invalid && loop->end)
> ! 	{
> ! 	  scan_loop (loop, flags);
> ! 	  ggc_collect ();
> ! 	}
>       }

-- 
- Geoffrey Keating <geoffk@geoffk.org>



More information about the Gcc-patches mailing list