diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2021-09-11 17:33:25 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2021-09-13 16:34:48 +0200 |
commit | c7a669af0aeb639eb78f1614cbecb72a98d81ce8 (patch) | |
tree | a696301076a76ac2f3a927db342d94b700b0ff33 /gcc/tree-ssa-threadbackward.c | |
parent | c8b2b89358481d36755dbc99e585a251780453b0 (diff) | |
download | gcc-c7a669af0aeb639eb78f1614cbecb72a98d81ce8.zip gcc-c7a669af0aeb639eb78f1614cbecb72a98d81ce8.tar.gz gcc-c7a669af0aeb639eb78f1614cbecb72a98d81ce8.tar.bz2 |
Remove references to FSM threads.
Now that the jump thread back registry has been split into the generic
copier and the custom (old) copier, it becomes trivial to remove the
FSM bits from the jump threaders.
First, there's no need for an EDGE_FSM_THREAD type. The only reason
we were looking at the threading type was to determine what type of
copier to use, and now that the copier has been split, there's no need
to even look. However, there is one check in register_jump_thread
where we verify that only the generic copier can thread through
back-edges. I've removed that check in favor of a flag passed to the
constructor.
I've also removed all the FSM references from the code and tests.
Interestingly, some tests weren't even testing the right thing. They
were testing for "FSM" which would catch jump thread paths as well as
the backward threader *failing* on registering a path. *big eye roll*
The only remaining code that was actually checking for EDGE_FSM_THREAD
was adjust_paths_after_duplication, and the checks could be written
without looking at the edge type at all. For the record, the code
there is horrible: it's convoluted, hard to read, and doesn't have any
tests. I'd smack myself if I could go back in time.
All that remains are the FSM references in the --param's themselves.
I think we should s/fsm/threader/, since I envision a day when we can
share the cost basis code between the threaders. However, I don't
know what the proper procedure is for renaming existing compiler
options.
By the way, param_fsm_maximum_phi_arguments is no longer relevant
after the rewrite. We can nuke that one right away.
Tested on x86-64 Linux.
gcc/ChangeLog:
* tree-ssa-threadbackward.c
(back_threader_profitability::profitable_path_p): Remove FSM
references.
(back_threader_registry::register_path): Same.
* tree-ssa-threadedge.c
(jump_threader::simplify_control_stmt_condition): Same.
* tree-ssa-threadupdate.c (jt_path_registry::jt_path_registry):
Add backedge_threads argument.
(fwd_jt_path_registry::fwd_jt_path_registry): Pass
backedge_threads argument.
(back_jt_path_registry::back_jt_path_registry): Same.
(dump_jump_thread_path): Adjust for FSM removal.
(back_jt_path_registry::rewire_first_differing_edge): Same.
(back_jt_path_registry::adjust_paths_after_duplication): Same.
(back_jt_path_registry::update_cfg): Same.
(jt_path_registry::register_jump_thread): Same.
* tree-ssa-threadupdate.h (enum jump_thread_edge_type): Remove
EDGE_FSM_THREAD.
(class back_jt_path_registry): Add backedge_threads to
constructor.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr21417.c: Adjust for FSM removal.
* gcc.dg/tree-ssa/pr66752-3.c: Same.
* gcc.dg/tree-ssa/pr68198.c: Same.
* gcc.dg/tree-ssa/pr69196-1.c: Same.
* gcc.dg/tree-ssa/pr70232.c: Same.
* gcc.dg/tree-ssa/pr77445.c: Same.
* gcc.dg/tree-ssa/ranger-threader-4.c: Same.
* gcc.dg/tree-ssa/ssa-dom-thread-18.c: Same.
* gcc.dg/tree-ssa/ssa-dom-thread-6.c: Same.
* gcc.dg/tree-ssa/ssa-thread-12.c: Same.
* gcc.dg/tree-ssa/ssa-thread-13.c: Same.
Diffstat (limited to 'gcc/tree-ssa-threadbackward.c')
-rw-r--r-- | gcc/tree-ssa-threadbackward.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c index 7ff5cec..805b7ac 100644 --- a/gcc/tree-ssa-threadbackward.c +++ b/gcc/tree-ssa-threadbackward.c @@ -593,7 +593,7 @@ back_threader_profitability::profitable_path_p (const vec<basic_block> &m_path, if (m_path.length () > (unsigned) param_max_fsm_thread_length) { if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, " FAIL: FSM jump-thread path not considered: " + fprintf (dump_file, " FAIL: Jump-thread path not considered: " "the number of basic blocks on the path " "exceeds PARAM_MAX_FSM_THREAD_LENGTH.\n"); return false; @@ -768,7 +768,7 @@ back_threader_profitability::profitable_path_p (const vec<basic_block> &m_path, if (path_crosses_loops) { if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, " FAIL: FSM jump-thread path not considered: " + fprintf (dump_file, " FAIL: Jump-thread path not considered: " "the path crosses loops.\n"); return false; } @@ -784,7 +784,7 @@ back_threader_profitability::profitable_path_p (const vec<basic_block> &m_path, if (n_insns >= param_max_fsm_thread_path_insns) { if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, " FAIL: FSM jump-thread path not considered: " + fprintf (dump_file, " FAIL: Jump-thread path not considered: " "the number of instructions on the path " "exceeds PARAM_MAX_FSM_THREAD_PATH_INSNS.\n"); return false; @@ -793,7 +793,7 @@ back_threader_profitability::profitable_path_p (const vec<basic_block> &m_path, else if (!m_speed_p && n_insns > 1) { if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, " FAIL: FSM jump-thread path not considered: " + fprintf (dump_file, " FAIL: Jump-thread path not considered: " "duplication of %i insns is needed and optimizing for size.\n", n_insns); return false; @@ -818,25 +818,22 @@ back_threader_profitability::profitable_path_p (const vec<basic_block> &m_path, { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, - " FAIL: FSM would create irreducible loop without threading " + " FAIL: Would create irreducible loop without threading " "multiway branch.\n"); return false; } - /* If this path does not thread through the loop latch, then we are - using the FSM threader to find old style jump threads. This - is good, except the FSM threader does not re-use an existing - threading path to reduce code duplication. - - So for that case, drastically reduce the number of statements - we are allowed to copy. */ + /* The generic copier used by the backthreader does not re-use an + existing threading path to reduce code duplication. So for that + case, drastically reduce the number of statements we are allowed + to copy. */ if (!(threaded_through_latch && threaded_multiway_branch) && (n_insns * param_fsm_scale_path_stmts >= param_max_jump_thread_duplication_stmts)) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, - " FAIL: FSM did not thread around loop and would copy too " + " FAIL: Did not thread around loop and would copy too " "many statements.\n"); return false; } @@ -849,7 +846,7 @@ back_threader_profitability::profitable_path_p (const vec<basic_block> &m_path, { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, - " FAIL: FSM Thread through multiway branch without threading " + " FAIL: Thread through multiway branch without threading " "a multiway branch.\n"); return false; } @@ -865,7 +862,7 @@ back_threader_profitability::profitable_path_p (const vec<basic_block> &m_path, { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, - " FAIL: FSM Thread through latch before loop opts would create non-empty latch\n"); + " FAIL: Thread through latch before loop opts would create non-empty latch\n"); return false; } @@ -887,8 +884,8 @@ back_threader_registry::register_path (const vec<basic_block> &m_path, if (m_threaded_paths > m_max_allowable_paths) { if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, " FAIL: FSM jump-thread path not considered: " - "the number of previously recorded FSM paths to " + fprintf (dump_file, " FAIL: Jump-thread path not considered: " + "the number of previously recorded paths to " "thread exceeds PARAM_MAX_FSM_THREAD_PATHS.\n"); return false; } @@ -896,7 +893,8 @@ back_threader_registry::register_path (const vec<basic_block> &m_path, vec<jump_thread_edge *> *jump_thread_path = m_lowlevel_registry.allocate_thread_path (); - /* Record the edges between the blocks in PATH. */ + // The generic copier ignores the edge type. We can build the + // thread edges with any type. for (unsigned int j = 0; j + 1 < m_path.length (); j++) { basic_block bb1 = m_path[m_path.length () - j - 1]; @@ -905,11 +903,10 @@ back_threader_registry::register_path (const vec<basic_block> &m_path, edge e = find_edge (bb1, bb2); gcc_assert (e); jump_thread_edge *x - = m_lowlevel_registry.allocate_thread_edge (e, EDGE_FSM_THREAD); + = m_lowlevel_registry.allocate_thread_edge (e, EDGE_COPY_SRC_BLOCK); jump_thread_path->safe_push (x); } - /* Add the edge taken when the control variable has value ARG. */ jump_thread_edge *x = m_lowlevel_registry.allocate_thread_edge (taken_edge, EDGE_NO_COPY_SRC_BLOCK); |