aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-05-29 09:48:14 +0200
committerEric Botcazou <ebotcazou@adacore.com>2023-05-29 11:13:42 +0200
commit89903c8b24c7883b4a400365706e7804298cc523 (patch)
tree03b1238bb1063a35173f62b36c41f261dfda3649
parent3fa303becdc877a77e67e04401a50246dd05bd81 (diff)
downloadgcc-89903c8b24c7883b4a400365706e7804298cc523.zip
gcc-89903c8b24c7883b4a400365706e7804298cc523.tar.gz
gcc-89903c8b24c7883b4a400365706e7804298cc523.tar.bz2
Fix incorrect SLOC inherited by induction variable increment
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.
-rw-r--r--gcc/tree-ssa-loop-manip.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/tree-ssa-loop-manip.cc b/gcc/tree-ssa-loop-manip.cc
index f336d22..b2d3dcf 100644
--- a/gcc/tree-ssa-loop-manip.cc
+++ b/gcc/tree-ssa-loop-manip.cc
@@ -131,10 +131,10 @@ create_iv (tree base, tree_code incr_op, tree step, tree var, class loop *loop,
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);