https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71661

--- Comment #6 from Jeffrey A. Law <law at redhat dot com> ---
As noted in my last comment, removal of a forwarder block may turn an
irreducible loop into a natural loop.  The loop header for any such exposed
natural loop will not be recognized as a loop header by tree_forwarder_block_p
(which avoids forwarding through loop headers).

So the easiest way to fix this problem is check if a block is a loop header in
remove_forwarder_block* rather than just in tree_forwarder_block_p.  This is
comparable to how we avoid infinite loops where we have this tidbit of code:

  /* We check for infinite loops already in tree_forwarder_block_p.
     However it may happen that the infinite loop is created
     afterwards due to removal of forwarders.  */
  if (dest == bb)
    return false;

Reply via email to