Allow fully resolving backward jump threading passes.
authorAldy Hernandez <aldyh@redhat.com>
Fri, 15 Oct 2021 12:46:32 +0000 (14:46 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Sun, 17 Oct 2021 16:51:39 +0000 (18:51 +0200)
commit5d4d64faa71a6389bfb76bfb3334b63360cf62c0
treec3eeb954ccd2460268b3fbdd4747bfc977c035b9
parent7319539d32b9c930f040350fc4d9c327cdf2dc0f
Allow fully resolving backward jump threading passes.

This refactors the backward threader pass so that it can be called in
either fully resolving mode, or in classic mode where any unknowns
default to VARYING.  Doing so opens the door for
"pass_thread_jumps_full" which has the resolving bits set.

This pass has not been added to the pipeline, but with it in place, we
can now experiment with it to see how to reduce the number of
jump threaders.  The first suspect will probably be enabling fully
resolving in the backward threader pass immediately preceeding VRP2,
and removing the VRP2 threader pass.  Now that VRP and the backward
threader are sharing a solver, and most of the threads get handcuffed
by cancel_threads(), we should have a variety of scenarios to try.

In the process, I have cleaned up things to make it trivial to see
what the difference between the 3 variants are (early jump
threading, quick jump threading without resolving SSAs, and fully
resolving jump threading).  Since I moved stuff around, it's probably
easier to just look at the last section in tree-ssa-threadbackward to
see how it's all laid out.

No functional changes as the new pass hasn't been added to the
pipeline.

gcc/ChangeLog:

* tree-pass.h (make_pass_thread_jumps_full): New.
* tree-ssa-threadbackward.c (pass_thread_jumps::gate): Inline.
(try_thread_blocks): Add resolve and speed arguments.
(pass_thread_jumps::execute): Inline.
(do_early_thread_jumps): New.
(do_thread_jumps): New.
(make_pass_thread_jumps): Move.
(pass_early_thread_jumps::gate): Inline.
(pass_early_thread_jumps::execute): Inline.
(class pass_thread_jumps_full): New.
gcc/tree-pass.h
gcc/tree-ssa-threadbackward.c