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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
create_new_iv is called with cand->pos being IP_END, where the last stmt of the
body is asm goto.
  __asm__ __volatile__ goto("" :  :  :  : "l2" l2);
;;    succ:       13

;;   basic block 13, loop depth 1
;;    pred:       9
;;                12
  # x_4 = PHI <x_10(D)(9), x_14(12)>
l2:

As the label is in the same bb as fallthrough, the bb which ends with asm goto
has just a single succ edge, but in order to insert something at the end of the
latch bb,
we would need to create a new bb, move the label to it and insert the iv there.
I guess gsi_insert_on_edge_immediate should be able to handle that case, or
perhaps just detect when gsi_last_bb (ip_end_pos (data->current_loop))
is GIMPLE_ASM or better yet stmt_ends_bb_p and split_edge in that case?

Reply via email to