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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
A more light-weight fix for the specific issue would be

Index: gcc/tree-cfgcleanup.c
===================================================================
--- gcc/tree-cfgcleanup.c       (revision 239117)
+++ gcc/tree-cfgcleanup.c       (working copy)
@@ -344,7 +344,7 @@ tree_forwarder_block_p (basic_block bb,
     {
       basic_block dest;
       /* Protect loop headers.  */
-      if (bb->loop_father->header == bb)
+      if (bb_loop_header_p (bb))
        return false;

       dest = EDGE_SUCC (bb, 0)->dest;

where bb_loop_header_p only relies on DOM info.  Of course other checks
are still bogus in the presence of new, undiscovered loops (and overly
cautionous in the case of removed loops not marked for removal).  This
applies to all loop related stuff done in CFG hooks as well (though if
LOOPS_NEED_FIXUP is set all the updates they do bogously or fail to do
are fixed by the required loop-fixup).  So in the end only CFG cleanup
routines guarding transforms require up-to-date loop info.  The above
is nearly the only one (with the following preheader/latch checks
falling into the same category as the CFG hook cases).  So the above
might be a complete fix at this point.  Testing that now.

Reply via email to