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

Zdenek Dvorak rakdver@iuuk.mff.cuni.cz
Wed Jan 4 13:24:00 GMT 2012


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



More information about the Gcc-patches mailing list