https://gcc.gnu.org/g:68734596ebe70dfd193ec7f200c68f3754d03ad7

commit r17-5363-g68734596ebe70dfd193ec7f200c68f3754d03ad7
Author: Trevor Saunders <[email protected]>
Date:   Fri Oct 16 17:29:41 2026 +0200

    Replace XEXP of a LABEL_REF with label_ref_label
    
    gcc/ChangeLog:
    
            * cfgrtl.cc (delete_insn): Use label_ref_label.
            (force_nonfallthru_and_redirect): Likewise.
            * cse.cc (cse_insn): Likewise.
            * dwarf2cfi.cc (create_trace_edges): Likewise.
            * jump.cc (delete_related_insns): Likewise.
            * reload.cc (subst_reloads): Likewise.

Diff:
---
 gcc/cfgrtl.cc    | 6 +++---
 gcc/cse.cc       | 2 +-
 gcc/dwarf2cfi.cc | 4 ++--
 gcc/jump.cc      | 4 ++--
 gcc/reload.cc    | 3 ++-
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/gcc/cfgrtl.cc b/gcc/cfgrtl.cc
index 474b84a08934..51059294d5f0 100644
--- a/gcc/cfgrtl.cc
+++ b/gcc/cfgrtl.cc
@@ -215,7 +215,7 @@ delete_insn (rtx_insn *insn)
 
       for (i = 0; i < len; i++)
        {
-         rtx label = XEXP (RTVEC_ELT (vec, i), 0);
+         rtx_insn *label = label_ref_label (RTVEC_ELT (vec, i));
 
          /* When deleting code in bulk (e.g. removing many unreachable
             blocks) we can delete a label that's a target of the vector
@@ -1667,10 +1667,10 @@ force_nonfallthru_and_redirect (edge e, basic_block 
target, rtx jump_label)
          for (int i = 0; i < n; ++i)
            if (XEXP (ASM_OPERANDS_LABEL (note, i), 0) == BB_HEAD (e->dest))
              {
-               LABEL_NUSES (XEXP (ASM_OPERANDS_LABEL (note, i), 0))--;
+               LABEL_NUSES (label_ref_label (ASM_OPERANDS_LABEL (note, i)))--;
                XEXP (ASM_OPERANDS_LABEL (note, i), 0)
                  = block_label (jump_block);
-               LABEL_NUSES (XEXP (ASM_OPERANDS_LABEL (note, i), 0))++;
+               LABEL_NUSES (label_ref_label (ASM_OPERANDS_LABEL (note, i)))++;
              }
 
          rtx_insn *insn = BB_END (new_edge->src);
diff --git a/gcc/cse.cc b/gcc/cse.cc
index 044386f1cf08..697d03f32511 100644
--- a/gcc/cse.cc
+++ b/gcc/cse.cc
@@ -5710,7 +5710,7 @@ cse_insn (rtx_insn *insn)
              rtx_insn *seq = targetm.gen_jump (XEXP (src, 0));
              new_rtx = emit_jump_insn_before (seq, insn);
              JUMP_LABEL (new_rtx) = XEXP (src, 0);
-             LABEL_NUSES (XEXP (src, 0))++;
+             LABEL_NUSES (label_ref_label (src))++;
 
              /* Make sure to copy over REG_NON_LOCAL_GOTO.  */
              note = find_reg_note (insn, REG_NON_LOCAL_GOTO, 0);
diff --git a/gcc/dwarf2cfi.cc b/gcc/dwarf2cfi.cc
index a7c00354ff13..b79294c97194 100644
--- a/gcc/dwarf2cfi.cc
+++ b/gcc/dwarf2cfi.cc
@@ -2657,7 +2657,7 @@ create_trace_edges (rtx_insn *insn)
          n = GET_NUM_ELEM (vec);
          for (i = 0; i < n; ++i)
            {
-             rtx_insn *lab = as_a <rtx_insn *> (XEXP (RTVEC_ELT (vec, i), 0));
+             rtx_insn *lab = label_ref_label (RTVEC_ELT (vec, i));
              maybe_record_trace_start (lab, insn);
            }
 
@@ -2683,7 +2683,7 @@ create_trace_edges (rtx_insn *insn)
          for (i = 0; i < n; ++i)
            {
              rtx_insn *lab =
-               as_a <rtx_insn *> (XEXP (ASM_OPERANDS_LABEL (tmp, i), 0));
+               label_ref_label (ASM_OPERANDS_LABEL (tmp, i));
              maybe_record_trace_start (lab, insn);
            }
        }
diff --git a/gcc/jump.cc b/gcc/jump.cc
index 973c776fe601..100a0b136117 100644
--- a/gcc/jump.cc
+++ b/gcc/jump.cc
@@ -1263,8 +1263,8 @@ delete_related_insns (rtx uncast_insn)
       int len = GET_NUM_ELEM (labels);
 
       for (i = 0; i < len; i++)
-       if (LABEL_NUSES (XEXP (RTVEC_ELT (labels, i), 0)) == 0)
-         delete_related_insns (XEXP (RTVEC_ELT (labels, i), 0));
+       if (LABEL_NUSES (label_ref_label (RTVEC_ELT (labels, i))) == 0)
+         delete_related_insns (label_ref_label (RTVEC_ELT (labels, i)));
       while (next && next->deleted ())
        next = NEXT_INSN (next);
       return next;
diff --git a/gcc/reload.cc b/gcc/reload.cc
index 6f4711d782ed..284e90e40e47 100644
--- a/gcc/reload.cc
+++ b/gcc/reload.cc
@@ -6310,7 +6310,8 @@ subst_reloads (rtx_insn *insn)
                      || find_reg_note (insn,
                                        REG_LABEL_OPERAND,
                                        XEXP (*r->where, 0))
-                     || label_is_jump_target_p (XEXP (*r->where, 0), insn));
+                     || label_is_jump_target_p (label_ref_label (*r->where),
+                                                insn));
 
          /* Encapsulate RELOADREG so its machine mode matches what
             used to be there.  Note that gen_lowpart_common will

Reply via email to