]> gcc.gnu.org Git - gcc.git/commitdiff
Fix incorrect SLOC inherited by induction variable increment
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 29 May 2023 07:48:14 +0000 (09:48 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Mon, 29 May 2023 09:13:42 +0000 (11:13 +0200)
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.

gcc/tree-ssa-loop-manip.cc

index f336d22243346ba865c2f48fa7d802debb9a9ea6..b2d3dcf406d45a8c5206fbdf7e0f20600c8a2b6a 100644 (file)
@@ -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);
This page took 0.058564 seconds and 5 git commands to generate.