On 9/13/2021 3:54 AM, Aldy Hernandez wrote:
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.

OK?

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.
OK
jeff

Reply via email to