public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* retain debug stmt order when moving to successors
@ 2021-07-28  7:23 Alexandre Oliva
  2021-07-28 12:34 ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Oliva @ 2021-07-28  7:23 UTC (permalink / raw)
  To: gcc-patches


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.

Regstrapped on x86_64-linux-gnu.  Ok to install?

for  gcc/ChangeLog

	* tree-inline.c (maybe_move_debug_stmts_to_successors): Don't
	reverse debug stmts.
---
 gcc/tree-inline.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 4a07d88f10bc5..b188a21df0e07 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2868,7 +2868,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;
 	    }
 
@@ -2894,7 +2894,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);
 	}


-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: retain debug stmt order when moving to successors
  2021-07-28  7:23 retain debug stmt order when moving to successors Alexandre Oliva
@ 2021-07-28 12:34 ` Richard Biener
  2021-08-17 11:04   ` Alexandre Oliva
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2021-07-28 12:34 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: GCC Patches

On Wed, Jul 28, 2021 at 10:12 AM Alexandre Oliva <oliva@adacore.com> wrote:
>
>
> 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.
>
> Regstrapped on x86_64-linux-gnu.  Ok to install?

OK.

Richard.

> for  gcc/ChangeLog
>
>         * tree-inline.c (maybe_move_debug_stmts_to_successors): Don't
>         reverse debug stmts.
> ---
>  gcc/tree-inline.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
> index 4a07d88f10bc5..b188a21df0e07 100644
> --- a/gcc/tree-inline.c
> +++ b/gcc/tree-inline.c
> @@ -2868,7 +2868,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;
>             }
>
> @@ -2894,7 +2894,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);
>         }
>
>
> --
> Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
>    Free Software Activist                       GNU Toolchain Engineer
> Disinformation flourishes because many people care deeply about injustice
> but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: retain debug stmt order when moving to successors
  2021-07-28 12:34 ` Richard Biener
@ 2021-08-17 11:04   ` Alexandre Oliva
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2021-08-17 11:04 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

On Jul 28, 2021, Richard Biener <richard.guenther@gmail.com> wrote:

> OK.

Thanks, I've finally put this in.  Sorry about the delay.

> On Wed, Jul 28, 2021 at 10:12 AM Alexandre Oliva <oliva@adacore.com> wrote:
>> * tree-inline.c (maybe_move_debug_stmts_to_successors): Don't
>> reverse debug stmts.



-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-17 11:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28  7:23 retain debug stmt order when moving to successors Alexandre Oliva
2021-07-28 12:34 ` Richard Biener
2021-08-17 11:04   ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).