> On Fri, Nov 20, 2015 at 9:03 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> > Hi!
> >
> > node->get_body () can run various IPA passes and ggc_collect in them
> 
> Aww.  Looks like we never implemented that ggc_defer_collecting idea
> (don't remember the context this popped up, maybe it was when we
> introduced TODO_do_not_ggc_collect).  At least late IPA passes
> might be affected by this issue as well.

We used to have way to push/pop ggc context, but that was removed eventually.
I agree that get_ody doing random ggc_collect is not the best idea.  What 
get_body
is doing is application of transform passes of individual IPA passes.  We could
probably just not do ggc_collect between these? Those are not full bloat
passes, just transform methods.

Honza
> 
> Richard.
> 
> >, so
> > it is undesirable to hold pointers to GC memory in automatic vars over it.
> > While I could store those vars (clone_info, clone and id) into special GTY
> > vars just to avoid collecting them, it seems easier to call node->get_body
> > () earlier.
> >
> > Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk
> > and 5 branch.
> >
> > 2015-11-20  Jakub Jelinek  <ja...@redhat.com>
> >
> >         PR middle-end/68339
> >         * omp-low.c (expand_simd_clones): Call node->get_body () before
> >         allocating stuff in GC.
> >
> >         * gcc.dg/vect/pr68339.c: New test.
> >
> > --- gcc/omp-low.c.jj    2015-11-18 11:19:19.000000000 +0100
> > +++ gcc/omp-low.c       2015-11-20 12:56:17.075193601 +0100
> > @@ -18319,6 +18319,10 @@ expand_simd_clones (struct cgraph_node *
> >        && TYPE_ARG_TYPES (TREE_TYPE (node->decl)) == NULL_TREE)
> >      return;
> >
> > +  /* Call this before creating clone_info, as it might ggc_collect.  */
> > +  if (node->definition && node->has_gimple_body_p ())
> > +    node->get_body ();
> > +
> >    do
> >      {
> >        /* Start with parsing the "omp declare simd" attribute(s).  */
> > --- gcc/testsuite/gcc.dg/vect/pr68339.c.jj      2015-11-20 
> > 13:10:47.756905395 +0100
> > +++ gcc/testsuite/gcc.dg/vect/pr68339.c 2015-11-20 13:08:13.000000000 +0100
> > @@ -0,0 +1,17 @@
> > +/* PR middle-end/68339 */
> > +/* { dg-do compile } */
> > +/* { dg-options "--param ggc-min-heapsize=0 --param ggc-min-expand=0 
> > -fopenmp-simd" } */
> > +
> > +#pragma omp declare simd notinbranch
> > +int
> > +f1 (int x)
> > +{
> > +  return x;
> > +}
> > +
> > +#pragma omp declare simd notinbranch
> > +int
> > +f2 (int x)
> > +{
> > +  return x;
> > +}
> >
> >         Jakub

Reply via email to