Re: [PATCH] clean(sel-sched-ir): Removed Unused Declarations.

Andrea Pinski <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <CALvbMcBZ=roDdU3PX0ft_rxeaoJbm0Zx9qFrqc6d1s8gGDxTmA@mail.gmail.com>
On Fri, Aug 14, 2026 at 8:08 PM Léo Hardt <[email protected]> wrote:
>
> Good evening,
>
> The following patch only removes dead code.
>
> For the convenience of reviewers, I included
> both the commit in which such code was added,
> and in which it was made obsolete below.
>
> No behaviour change is therefore expected.
> Nevertheless, I successfully bootstrapped it.
>
>
> 1) Added in e855c69d162, but never used:
>
>     copy_data_sets insn_at_boundary_p _list_iter_cond_x
>     sel_init_invalid_data_sets sel_save_haifa_priorities
>     insn_eligible_for_subst_p
>
> 2) Added in e855c69d162 but made redundant in de8ea9631cf:
>
>     _xlist_add _xlist_remove _xlist_clear _xlist_is_in_p
>     _xlist_iter_remove _xlist_iterator _FOR_EACH_X _FOR_EACH_X_1
>     _XLIST_NEXT _XLIST_X
>
> The '_xlist'-related declarations were replaced by inline
> functions. See the broader context in:
> https://gcc.gnu.org/pipermail/gcc-patches/2014-August/395247.html
>
>
>
> gcc/ChangeLog:
>
>         * sel-sched-ir.cc (copy_data_sets): Removed dead code.
>         * sel-sched-ir.h (_XLIST_X): Likewise.
>         (_XLIST_NEXT): Likewise.
>         (_xlist_add): Likewise.
>         (_xlist_remove): Likewise.
>         (_xlist_clear): Likewise.
>         (_xlist_is_in_p): Likewise.
>         (_list_iter_cond_x): Likewise.
>         (_xlist_iter_remove): Likewise.
>         (_FOR_EACH_X): Likewise.
>         (_FOR_EACH_X_1): Likewise.
>         (sel_save_haifa_priorities): Likewise.
>         (insn_eligible_for_subst_p): Likewise.
>         (sel_init_invalid_data_sets): Likewise.
>         (insn_at_boundary_p): Likewise.
>         (copy_data_sets): Likewise.

Ok, thanks for these cleanup and thanks for the references of when the
functions were added and made unused it is definitely useful. I will
push this tomorrow if someone does not beat me to it.

Thanks,
Andrea


>
> Signed-off-by: Léo Hardt <[email protected]>
> ---
>   gcc/sel-sched-ir.cc | 21 -----------------
>   gcc/sel-sched-ir.h  | 57 ---------------------------------------------
>   2 files changed, 78 deletions(-)
>
> diff --git a/gcc/sel-sched-ir.cc b/gcc/sel-sched-ir.cc
> index c80ffe3ce81..bae404657dd 100644
> --- a/gcc/sel-sched-ir.cc
> +++ b/gcc/sel-sched-ir.cc
> @@ -4465,27 +4465,6 @@ exchange_data_sets (basic_block to, basic_block from)
>     std::swap (BB_AV_LEVEL (from), BB_AV_LEVEL (to));
>   }
>
> -/* Copy data sets of FROM to TO.  */
> -void
> -copy_data_sets (basic_block to, basic_block from)
> -{
> -  gcc_assert (!BB_LV_SET_VALID_P (to) && !BB_AV_SET_VALID_P (to));
> -  gcc_assert (BB_AV_SET (to) == NULL);
> -
> -  BB_AV_LEVEL (to) = BB_AV_LEVEL (from);
> -  BB_LV_SET_VALID_P (to) = BB_LV_SET_VALID_P (from);
> -
> -  if (BB_AV_SET_VALID_P (from))
> -    {
> -      BB_AV_SET (to) = av_set_copy (BB_AV_SET (from));
> -    }
> -  if (BB_LV_SET_VALID_P (from))
> -    {
> -      gcc_assert (BB_LV_SET (to) != NULL);
> -      COPY_REG_SET (BB_LV_SET (to), BB_LV_SET (from));
> -    }
> -}
> -
>   /* Return an av set for INSN, if any.  */
>   av_set_t
>   get_av_set (insn_t insn)
> diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
> index 07db5503308..c7714818840 100644
> --- a/gcc/sel-sched-ir.h
> +++ b/gcc/sel-sched-ir.h
> @@ -42,12 +42,6 @@ typedef struct idata_def *idata_t;
>   struct vinsn_def;
>   typedef struct vinsn_def *vinsn_t;
>
> -/* RTX list.
> -   This type is the backend for ilist.  */
> -typedef _list_t _xlist_t;
> -#define _XLIST_X(L) ((L)->u.x)
> -#define _XLIST_NEXT(L) (_LIST_NEXT (L))
> -
>   /* Instruction.  */
>   typedef rtx_insn *insn_t;
>
> @@ -455,51 +449,6 @@ _list_iter_remove_nofree (_list_iterator *ip)
>          _list_iter_next (&(I)))
>
>
> -/* _xlist_t functions.  */
> -
> -inline void
> -_xlist_add (_xlist_t *lp, rtx x)
> -{
> -  _list_add (lp);
> -  _XLIST_X (*lp) = x;
> -}
> -
> -#define _xlist_remove(LP) (_list_remove (LP))
> -#define _xlist_clear(LP) (_list_clear (LP))
> -
> -inline bool
> -_xlist_is_in_p (_xlist_t l, rtx x)
> -{
> -  while (l)
> -    {
> -      if (_XLIST_X (l) == x)
> -        return true;
> -      l = _XLIST_NEXT (l);
> -    }
> -
> -  return false;
> -}
> -
> -/* Used through _FOR_EACH.  */
> -inline bool
> -_list_iter_cond_x (_xlist_t l, rtx *xp)
> -{
> -  if (l)
> -    {
> -      *xp = _XLIST_X (l);
> -      return true;
> -    }
> -
> -  return false;
> -}
> -
> -#define _xlist_iter_remove(IP) (_list_iter_remove (IP))
> -
> -typedef _list_iterator _xlist_iterator;
> -#define _FOR_EACH_X(X, I, L) _FOR_EACH (x, (X), (I), (L))
> -#define _FOR_EACH_X_1(X, I, LP) _FOR_EACH_1 (x, (X), (I), (LP))
> -
> -
>   /* ilist_t functions.  */
>
>   inline void
> @@ -1577,8 +1526,6 @@ extern void av_set_substract_cond_branches (av_set_t
> *);
>   extern void av_set_split_usefulness (av_set_t, int, int);
>   extern void av_set_code_motion_filter (av_set_t *, av_set_t);
>
> -extern void sel_save_haifa_priorities (void);
> -
>   extern void sel_init_global_and_expr (bb_vec_t);
>   extern void sel_finish_global_and_expr (void);
>
> @@ -1593,14 +1540,11 @@ extern int tick_check_p (expr_t, deps_t, fence_t);
>
>   /* Functions to work with insns.  */
>   extern bool lhs_of_insn_equals_to_dest_p (insn_t, rtx);
> -extern bool insn_eligible_for_subst_p (insn_t);
>   extern void get_dest_and_mode (rtx, rtx *, machine_mode *);
>
>   extern bool bookkeeping_can_be_created_if_moved_through_p (insn_t);
>   extern bool sel_remove_insn (insn_t, bool, bool);
>   extern bool bb_header_p (insn_t);
> -extern void sel_init_invalid_data_sets (insn_t);
> -extern bool insn_at_boundary_p (insn_t);
>
>   /* Basic block and CFG functions.  */
>
> @@ -1644,7 +1588,6 @@ extern bool sel_is_loop_preheader_p (basic_block);
>   extern void clear_outdated_rtx_info (basic_block);
>   extern void free_data_sets (basic_block);
>   extern void exchange_data_sets (basic_block, basic_block);
> -extern void copy_data_sets (basic_block, basic_block);
>
>   extern void sel_register_cfg_hooks (void);
>   extern void sel_unregister_cfg_hooks (void);
> --
> 2.39.5
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.