https://gcc.gnu.org/g:ea81d6229004cab01c383fff069dd380bef74eb1

commit r17-5370-gea81d6229004cab01c383fff069dd380bef74eb1
Author: Trevor Saunders <[email protected]>
Date:   Fri Oct 16 18:23:34 2026 +0200

    Use dyn_cast in delete_insn
    
    Bind the label case as an rtx_code_label * instead of casting again
    for the label helpers.
    
    gcc/ChangeLog:
    
            * cfgrtl.cc (delete_insn): Use dyn_cast for the label case.

Diff:
---
 gcc/cfgrtl.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/cfgrtl.cc b/gcc/cfgrtl.cc
index c03ddc05bad8..07ca8830305c 100644
--- a/gcc/cfgrtl.cc
+++ b/gcc/cfgrtl.cc
@@ -138,14 +138,14 @@ delete_insn (rtx_insn *insn)
   rtx note;
   bool really_delete = true;
 
-  if (LABEL_P (insn))
+  if (rtx_code_label *label = dyn_cast<rtx_code_label *> (insn))
     {
       /* Some labels can't be directly removed from the INSN chain, as they
         might be references via variables, constant pool etc.
         Convert them to the special NOTE_INSN_DELETED_LABEL note.  */
-      if (! can_delete_label_p (as_a <rtx_code_label *> (insn)))
+      if (! can_delete_label_p (label))
        {
-         const char *name = LABEL_NAME (insn);
+         const char *name = LABEL_NAME (label);
          basic_block bb = BLOCK_FOR_INSN (insn);
          rtx_insn *bb_note = NEXT_INSN (insn);

Reply via email to