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]

Re: PR rtl-optimization/49710 (segfault in loop peeling)


Hi,

> --- 316,333 ----
>        normally.   We may assume that e->dest is not a header of any loop,
>        as it now has exactly one predecessor.  */
>     while (loop_outer (e->src->loop_father)
> !         && dominated_by_p (CDI_DOMINATORS,
> !                            e->src->loop_father->latch, e->dest))
>       unloop (e->src->loop_father, &irred_invalidated);
> +   l = e->src->loop_father;
> +   while (l && loop_outer (l))
> +     {
> +       while (loop_outer (loop_outer (l))
> + 	     && dominated_by_p (CDI_DOMINATORS,
> + 			        loop_outer (l)->latch, e->dest))
> +         unloop (loop_outer (l), &irred_invalidated);
> +       l = loop_outer (l);
> +     }

this will not work when e->src->loop_father is the cancelled loop,
since the first loop tested for removal is loop_outer (e->src->loop_father).

I would suggest

for (l = e->src->loop_father; loop_outer (l); l = f)
  {
    f = loop_outer (l);
    if (dominated_by_p (CDI_DOMINATORS, l->latch, e->dest))
      unloop (l, &irred_invalidated);
  }

Otherwise ok,

Zdenek


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