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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |rguenth at gcc dot gnu.org,
                   |                            |rsandifo at gcc dot gnu.org
            Summary|ICE: in single_pred_edge,   |[12 Regression] ICE: in
                   |at basic-block.h:350 under  |single_pred_edge, at
                   |"-O2 -fno-toplevel-reorder  |basic-block.h:350 under
                   |-fno-tree-ch -fno-tree-dce  |"-O2 -fno-toplevel-reorder
                   |-fno-tree-dominator-opts    |-fno-tree-ch -fno-tree-dce
                   |-fno-tree-dse               |-fno-tree-dominator-opts
                   |-fno-tree-loop-ivcanon      |-fno-tree-dse
                   |-fpredictive-commoning"     |-fno-tree-loop-ivcanon
                   |                            |-fpredictive-commoning"
           Keywords|                            |ice-on-valid-code,
                   |                            |needs-bisection, wrong-code
   Last reconfirmed|                            |2021-09-17
   Target Milestone|---                         |12.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Huh, the code is odd:

  basic_block exit_bb = single_pred (loop->latch);
  new_exit = find_edge (exit_bb, rest);
  new_exit->probability = profile_probability::always ()
                                .apply_scale (1, new_est_niter + 1);

but here we have a diamond after the block that exits the loop and thus
neither a single predecessor of the latch nor would that be something
resembling an exit block.  It looks like the code might have wanted
to use single_pred (rest) here plus eventually splitting the exit
edge in case it didn't have a single predecessor.

Richard, you refactored this, so likely caused this.

Reply via email to