* [PATCH] rtl-ssa: Don't leave NOTE_INSN_DELETED around
@ 2023-10-20 9:43 Alex Coplan
2023-10-20 10:36 ` Richard Sandiford
0 siblings, 1 reply; 2+ messages in thread
From: Alex Coplan @ 2023-10-20 9:43 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Sandiford
[-- Attachment #1: Type: text/plain, Size: 892 bytes --]
Hi,
This patch tweaks change_insns to also call ::remove_insn to ensure the
underlying RTL insn gets removed from the insn chain in the case of a
deletion.
This avoids leaving NOTE_INSN_DELETED around after deleting insns.
For movement, the RTL insn chain is updated earlier in change_insns with
the call to move_insn. For deletion, it seems reasonable to do it here.
Bootstrapped/regtested on aarch64-linux-gnu in combination with the upcoming
aarch64 load pair pass, i.e.:
https://gcc.gnu.org/pipermail/gcc-patches/2023-October/633601.html
and all uncommitted prerequisites except for 6/11 i.e.:
https://gcc.gnu.org/pipermail/gcc-patches/2023-October/633349.html
which shows that 6/11 is no longer required in combination with this patch (as
expected).
Thanks,
Alex
gcc/ChangeLog:
* rtl-ssa/changes.cc (function_info::change_insns): Ensure we call
::remove_insn on deleted insns.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 638 bytes --]
diff --git a/gcc/rtl-ssa/changes.cc b/gcc/rtl-ssa/changes.cc
index b11a88e0919..d6874e5627c 100644
--- a/gcc/rtl-ssa/changes.cc
+++ b/gcc/rtl-ssa/changes.cc
@@ -732,7 +732,11 @@ function_info::change_insns (array_slice<insn_change *> changes)
insn_change &change = *changes[i];
insn_info *insn = change.insn ();
if (change.is_deletion ())
- remove_insn (insn);
+ {
+ if (rtx_insn *rtl = insn->rtl ())
+ ::remove_insn (rtl); // Remove the underlying RTL insn.
+ remove_insn (insn);
+ }
else if (insn_info *placeholder = placeholders[i])
{
// Check if earlier movements turned a move into a no-op.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] rtl-ssa: Don't leave NOTE_INSN_DELETED around
2023-10-20 9:43 [PATCH] rtl-ssa: Don't leave NOTE_INSN_DELETED around Alex Coplan
@ 2023-10-20 10:36 ` Richard Sandiford
0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2023-10-20 10:36 UTC (permalink / raw)
To: Alex Coplan; +Cc: gcc-patches
Alex Coplan <alex.coplan@arm.com> writes:
> Hi,
>
> This patch tweaks change_insns to also call ::remove_insn to ensure the
> underlying RTL insn gets removed from the insn chain in the case of a
> deletion.
>
> This avoids leaving NOTE_INSN_DELETED around after deleting insns.
>
> For movement, the RTL insn chain is updated earlier in change_insns with
> the call to move_insn. For deletion, it seems reasonable to do it here.
>
> Bootstrapped/regtested on aarch64-linux-gnu in combination with the upcoming
> aarch64 load pair pass, i.e.:
> https://gcc.gnu.org/pipermail/gcc-patches/2023-October/633601.html
> and all uncommitted prerequisites except for 6/11 i.e.:
> https://gcc.gnu.org/pipermail/gcc-patches/2023-October/633349.html
> which shows that 6/11 is no longer required in combination with this patch (as
> expected).
>
> Thanks,
> Alex
>
> gcc/ChangeLog:
>
> * rtl-ssa/changes.cc (function_info::change_insns): Ensure we call
> ::remove_insn on deleted insns.
OK, thanks.
Richard
> diff --git a/gcc/rtl-ssa/changes.cc b/gcc/rtl-ssa/changes.cc
> index b11a88e0919..d6874e5627c 100644
> --- a/gcc/rtl-ssa/changes.cc
> +++ b/gcc/rtl-ssa/changes.cc
> @@ -732,7 +732,11 @@ function_info::change_insns (array_slice<insn_change *> changes)
> insn_change &change = *changes[i];
> insn_info *insn = change.insn ();
> if (change.is_deletion ())
> - remove_insn (insn);
> + {
> + if (rtx_insn *rtl = insn->rtl ())
> + ::remove_insn (rtl); // Remove the underlying RTL insn.
> + remove_insn (insn);
> + }
> else if (insn_info *placeholder = placeholders[i])
> {
> // Check if earlier movements turned a move into a no-op.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-20 10:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20 9:43 [PATCH] rtl-ssa: Don't leave NOTE_INSN_DELETED around Alex Coplan
2023-10-20 10:36 ` Richard Sandiford
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).