Message ID | 20240716223459.3323793-1-quic_apinski@quicinc.com |
---|---|
State | New |
Headers | show |
Series | Add debug counter for ext_dce | expand |
On Tue, Jul 16, 2024 at 3:36 PM Andrew Pinski <quic_apinski@quicinc.com> wrote: > > Like r15-1610-gb6215065a5b143 (which adds one for late_combine), > adding one for ext_dce is useful to debug some issues with this pass. > > Bootstrapped and tested on x86_64-linux-gnu with no regressions. > > gcc/ChangeLog: > > * dbgcnt.def (ext_dce): New debug counter. > * ext-dce.cc (ext_dce_try_optimize_insn): Reject the insn > if the debug counter says so. I forgot to update the changelog after I added the name change of ext_dce inside ex-dce.cc. I don't think I need to send a new patch for this since it is only a change to the commit message. This will be added to the changelog (note there is a tab before the `(`; gmail removed it): (ext_dce): Rename to ... (ext_dce_execute): This. (pass_ext_dce::execute): Update for the name of ext_dce. Thanks, Andrew > > Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com> > --- > gcc/dbgcnt.def | 1 + > gcc/ext-dce.cc | 16 +++++++++++++--- > 2 files changed, 14 insertions(+), 3 deletions(-) > > diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def > index e0b9b1b2a76..ac1f8709849 100644 > --- a/gcc/dbgcnt.def > +++ b/gcc/dbgcnt.def > @@ -162,6 +162,7 @@ DEBUG_COUNTER (dom_unreachable_edges) > DEBUG_COUNTER (dse) > DEBUG_COUNTER (dse1) > DEBUG_COUNTER (dse2) > +DEBUG_COUNTER (ext_dce) > DEBUG_COUNTER (form_fma) > DEBUG_COUNTER (gcse2_delete) > DEBUG_COUNTER (gimple_unroll) > diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc > index 6c961feee63..6d4b8858ec6 100644 > --- a/gcc/ext-dce.cc > +++ b/gcc/ext-dce.cc > @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see > #include "rtl-iter.h" > #include "df.h" > #include "print-rtl.h" > +#include "dbgcnt.h" > > /* These should probably move into a C++ class. */ > static vec<bitmap_head> livein; > @@ -312,6 +313,15 @@ ext_dce_try_optimize_insn (rtx_insn *insn, rtx set) > print_rtl_single (dump_file, SET_SRC (set)); > } > > + /* We decided to turn do the optimization but allow it to be rejected for > + bisection purposes. */ > + if (!dbg_cnt (::ext_dce)) > + { > + if (dump_file) > + fprintf (dump_file, "Rejected due to debug counter.\n"); > + return; > + } > + > new_pattern = simplify_gen_subreg (GET_MODE (src), inner, > GET_MODE (inner), 0); > /* simplify_gen_subreg may fail in which case NEW_PATTERN will be NULL. > @@ -881,8 +891,8 @@ static bool ext_dce_rd_confluence_n (edge) { return true; } > are never read. Turn such extensions into SUBREGs instead which > can often be propagated away. */ > > -static void > -ext_dce (void) > +void > +ext_dce_execute (void) > { > df_analyze (); > ext_dce_init (); > @@ -929,7 +939,7 @@ public: > virtual bool gate (function *) { return flag_ext_dce && optimize > 0; } > virtual unsigned int execute (function *) > { > - ext_dce (); > + ext_dce_execute (); > return 0; > } > > -- > 2.43.0 >
On 7/16/24 4:34 PM, Andrew Pinski wrote: > Like r15-1610-gb6215065a5b143 (which adds one for late_combine), > adding one for ext_dce is useful to debug some issues with this pass. > > Bootstrapped and tested on x86_64-linux-gnu with no regressions. > > gcc/ChangeLog: > > * dbgcnt.def (ext_dce): New debug counter. > * ext-dce.cc (ext_dce_try_optimize_insn): Reject the insn > if the debug counter says so. This is, of course, fine. I've got a potential patch for the -Os issue that seems to be working. Debug counters are definitely useful. I think it's probably best to wait for me to wrap up the fix for that synthetic case, then go back and re-test harfbuzz. I just had a long unexpected interruption today, so I didn't get the time to walk over that fix again to make sure I was happy with it. jeff
diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def index e0b9b1b2a76..ac1f8709849 100644 --- a/gcc/dbgcnt.def +++ b/gcc/dbgcnt.def @@ -162,6 +162,7 @@ DEBUG_COUNTER (dom_unreachable_edges) DEBUG_COUNTER (dse) DEBUG_COUNTER (dse1) DEBUG_COUNTER (dse2) +DEBUG_COUNTER (ext_dce) DEBUG_COUNTER (form_fma) DEBUG_COUNTER (gcse2_delete) DEBUG_COUNTER (gimple_unroll) diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc index 6c961feee63..6d4b8858ec6 100644 --- a/gcc/ext-dce.cc +++ b/gcc/ext-dce.cc @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see #include "rtl-iter.h" #include "df.h" #include "print-rtl.h" +#include "dbgcnt.h" /* These should probably move into a C++ class. */ static vec<bitmap_head> livein; @@ -312,6 +313,15 @@ ext_dce_try_optimize_insn (rtx_insn *insn, rtx set) print_rtl_single (dump_file, SET_SRC (set)); } + /* We decided to turn do the optimization but allow it to be rejected for + bisection purposes. */ + if (!dbg_cnt (::ext_dce)) + { + if (dump_file) + fprintf (dump_file, "Rejected due to debug counter.\n"); + return; + } + new_pattern = simplify_gen_subreg (GET_MODE (src), inner, GET_MODE (inner), 0); /* simplify_gen_subreg may fail in which case NEW_PATTERN will be NULL. @@ -881,8 +891,8 @@ static bool ext_dce_rd_confluence_n (edge) { return true; } are never read. Turn such extensions into SUBREGs instead which can often be propagated away. */ -static void -ext_dce (void) +void +ext_dce_execute (void) { df_analyze (); ext_dce_init (); @@ -929,7 +939,7 @@ public: virtual bool gate (function *) { return flag_ext_dce && optimize > 0; } virtual unsigned int execute (function *) { - ext_dce (); + ext_dce_execute (); return 0; }
Like r15-1610-gb6215065a5b143 (which adds one for late_combine), adding one for ext_dce is useful to debug some issues with this pass. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * dbgcnt.def (ext_dce): New debug counter. * ext-dce.cc (ext_dce_try_optimize_insn): Reject the insn if the debug counter says so. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com> --- gcc/dbgcnt.def | 1 + gcc/ext-dce.cc | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-)