]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
retain debug stmt order when moving to successors
authorAlexandre Oliva <oliva@adacore.com>
Sun, 25 Jul 2021 02:05:33 +0000 (23:05 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Tue, 17 Aug 2021 11:00:40 +0000 (08:00 -0300)
We iterate over debug stmts from the last one in new_bb, and we insert
them before the first post-label stmt in each dest block, without
moving the insertion iterator, so they end up reversed.  Moving the
insertion iterator fixes this.

for  gcc/ChangeLog

* tree-inline.c (maybe_move_debug_stmts_to_successors): Don't
reverse debug stmts.

gcc/tree-inline.c

index c5d6b1e6489f756ed0d1d22dcad05c36b4e4d6c2..5955ff18fdbc5bac9236c2a0bcede769eea6e1aa 100644 (file)
@@ -2880,7 +2880,7 @@ maybe_move_debug_stmts_to_successors (copy_body_data *id, basic_block new_bb)
                  gimple_set_location (stmt, UNKNOWN_LOCATION);
                }
              gsi_remove (&si, false);
-             gsi_insert_before (&dsi, stmt, GSI_SAME_STMT);
+             gsi_insert_before (&dsi, stmt, GSI_NEW_STMT);
              continue;
            }
 
@@ -2906,7 +2906,7 @@ maybe_move_debug_stmts_to_successors (copy_body_data *id, basic_block new_bb)
            new_stmt = as_a <gdebug *> (gimple_copy (stmt));
          else
            gcc_unreachable ();
-         gsi_insert_before (&dsi, new_stmt, GSI_SAME_STMT);
+         gsi_insert_before (&dsi, new_stmt, GSI_NEW_STMT);
          id->debug_stmts.safe_push (new_stmt);
          gsi_prev (&ssi);
        }