On Sat, Sep 06, 2025 at 03:53:33PM -0700, Andrew Pinski wrote:
> On Sat, Sep 6, 2025 at 3:46 PM Jakub Jelinek <[email protected]> wrote:
> >
> > On Sat, Sep 06, 2025 at 03:27:53PM -0700, Andrew Pinski wrote:
> > > This new pass will ICE if the target does not define the 
> > > macro_fusion_pair_p
> > > pass. The pass will not be useful in that case so it is best to return
> > > early.
> > >
> > > Pushed as obvious after a bootstrap on x86_64-linux-gnu.
> > >
> > >       PR rtl-optimization/121835
> > > gcc/ChangeLog:
> > >
> > >       * dep-fusion.cc (pass_dep_fusion::execute): Return early if
> > >       macro_fusion_pair_p is null.
> >
> > Why not add
> >   && targetm.sched.macro_fusion_pair_p
> > to pass_dep_fusion::gate() instead?
> > You wouldn't get a useless dump file then.
> 
> I was thinking about that too, the problem with that is the way
> -fdump-passes works that if a target conditionally defines
> macro_fusion_pair_p based on options, -fdump-passes will not be
> correct. Maybe the problem is with how -fdump-passes figures out if a
> dump is enabled/disabled though.

First of all, no target does that.
git grep -i MACRO_FUSION_PAIR_P config
config/aarch64/aarch64.cc:/* Implement TARGET_SCHED_MACRO_FUSION_PAIR_P.  
Return true if PREV and CURR
config/aarch64/aarch64.cc:aarch_macro_fusion_pair_p (rtx_insn *prev, rtx_insn 
*curr)
config/aarch64/aarch64.cc:#undef TARGET_SCHED_MACRO_FUSION_PAIR_P
config/aarch64/aarch64.cc:#define TARGET_SCHED_MACRO_FUSION_PAIR_P 
aarch_macro_fusion_pair_p
config/arm/arm.cc:static bool aarch_macro_fusion_pair_p (rtx_insn*, rtx_insn*);
config/arm/arm.cc:#undef TARGET_SCHED_MACRO_FUSION_PAIR_P
config/arm/arm.cc:#define TARGET_SCHED_MACRO_FUSION_PAIR_P 
aarch_macro_fusion_pair_p
config/arm/arm.cc:aarch_macro_fusion_pair_p (rtx_insn* prev, rtx_insn* curr)
config/i386/i386-protos.h:extern bool ix86_macro_fusion_pair_p (rtx_insn 
*condgen, rtx_insn *condjmp);
config/i386/i386.cc:#undef TARGET_SCHED_MACRO_FUSION_PAIR_P
config/i386/i386.cc:#define TARGET_SCHED_MACRO_FUSION_PAIR_P 
ix86_macro_fusion_pair_p
config/i386/x86-tune-sched.cc:ix86_macro_fusion_pair_p (rtx_insn *condgen, 
rtx_insn *condjmp)
config/riscv/riscv.cc:/* Implement TARGET_SCHED_MACRO_FUSION_PAIR_P.  Return 
true if PREV and CURR
config/riscv/riscv.cc:riscv_macro_fusion_pair_p (rtx_insn *prev, rtx_insn *curr)
config/riscv/riscv.cc:#undef TARGET_SCHED_MACRO_FUSION_PAIR_P
config/riscv/riscv.cc:#define TARGET_SCHED_MACRO_FUSION_PAIR_P 
riscv_macro_fusion_pair_p
If some target doesn't need the hook for some sub-ISAs, it just returns
false from the hook for those options.
And second, targetm is used in quite a lot of other gates,
18 if I count well, and in some even as calling the hook rather than
just querying if it is non-NULL.

        Jakub

Reply via email to