This extends the condition to more cases involving debug instructions.
gcc/
* tree-ssa-loop-manip.cc (create_iv): Try harder to find a SLOC to
put onto the increment when it is inserted after the position.
immediately after a statement whose location is known. */
if (after)
{
- if (gsi_end_p (*incr_pos)
- || (is_gimple_debug (gsi_stmt (*incr_pos))
- && gsi_bb (*incr_pos)
- && gsi_end_p (gsi_last_nondebug_bb (gsi_bb (*incr_pos)))))
+ gimple_stmt_iterator gsi = *incr_pos;
+ if (!gsi_end_p (gsi))
+ gsi_next_nondebug (&gsi);
+ if (gsi_end_p (gsi))
{
edge e = single_succ_edge (gsi_bb (*incr_pos));
gimple_set_location (stmt, e->goto_locus);