]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rtl-ssa: Don't leave NOTE_INSN_DELETED around
authorAlex Coplan <alex.coplan@arm.com>
Fri, 20 Oct 2023 10:46:27 +0000 (11:46 +0100)
committerAlex Coplan <alex.coplan@arm.com>
Fri, 20 Oct 2023 10:46:27 +0000 (11:46 +0100)
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.

gcc/ChangeLog:

* rtl-ssa/changes.cc (function_info::change_insns): Ensure we call
::remove_insn on deleted insns.

gcc/rtl-ssa/changes.cc

index 523ad60d7d89c5189fb881dcc5a76e6a3f79f291..73ab3ccfd242245c9278df39aeed13fde3912c54 100644 (file)
@@ -706,7 +706,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.