--- Comment #8 from Jakub Jelinek <jakub at gcc dot> ---
(In reply to Thomas Preud'homme from comment #7)
> Hi Jakub,
> First of all, thanks for beating me to it. Wanted to look at it but am
> fighting strong headache since Wednesday.
> Regarding the second patch, I believe it is the right approach but found
> another bug in the surrounding lines which I think should be fixed in the
> same patch:
>           /* Absence of children might indicate an alternate root of a
> *chain*.
>              It's ok to skip it here as the chain will be renamed when
>              processing the canonical root for that chain.  */
>           if (node->get_children ()->empty ())
>             continue;
> Comment 1: I advocate removing this block altogether.

Agreed.  After all, what that skips over is:
          for (child_iter = node->get_children ()->begin ();
               child_iter != node->get_children ()->end (); child_iter++)
            to_process.safe_push (*child_iter);
          if (free)
              if (node->root_p ())
                delete static_cast<fma_root_node *> (node);
                delete node;
where the for loop will do nothing if node->get_children ()->empty () and the
freeing, which needs to be done too.

> Comment 2: Explain why deferred freeing is necessary on top of the line
> adding the node to to_free.
> Something along the lines of:
> /*  Defer freeing so that the process_node callback can access the parent
> and children of the node being processed.  */


Reply via email to