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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-01-15
           Priority|P3                          |P1
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  The ICE means that loop->num_nodes is out-of-date.

I see an early exit created BB which is in the wrong loop.  This:

      for (auto exit : loop_exits)
        {                         
          basic_block dest = main_loop_exit_block;
          if (exit != loop_exit)
            {
              if (!alt_loop_exit_block)
                {
                  alt_loop_exit_block = split_edge (exit);

splits an edge to __assert_fail but is then re-wried

                  edge res = redirect_edge_and_branch (
                                single_succ_edge (alt_loop_exit_block),
                                new_preheader);
                  flush_pending_stmts (res);
                  continue;

not sure why we split the edge before redirecting, swapping fixes the
testcase.  remove_bb_from_loops/add_bb_to_loop could also fixup with
the original order.

I'm testing swapping.

Reply via email to