diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2024-07-16 09:53:20 -0700 |
---|---|---|
committer | Andrew Pinski <quic_apinski@quicinc.com> | 2024-07-17 09:40:10 -0700 |
commit | 7c3287f3613210d4f98c8095bc739bea6582bfbb (patch) | |
tree | 5e280a392b22b1bc22a4c78c1b280a7d3e8cc308 | |
parent | 0841fd4c42ab053be951b7418233f0478282d020 (diff) | |
download | gcc-7c3287f3613210d4f98c8095bc739bea6582bfbb.zip gcc-7c3287f3613210d4f98c8095bc739bea6582bfbb.tar.gz gcc-7c3287f3613210d4f98c8095bc739bea6582bfbb.tar.bz2 |
Add debug counter for ext_dce
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.
(ext_dce): Rename to ...
(ext_dce_execute): This.
(pass_ext_dce::execute): Update for the name of ext_dce.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
-rw-r--r-- | gcc/dbgcnt.def | 1 | ||||
-rw-r--r-- | gcc/ext-dce.cc | 16 |
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def index e0b9b1b..ac1f870 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 6c961fe..6d4b885 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; } |