This is the ranger-based backwards threader. It is divided into two parts: the solver and the path discovery bits.
The solver is generic enough, that it may be of use to other passes, so it's been abstracted into its own separate class/file. Andrew and I have already gone over it, so I don't think a review is necessary. Besides, it's technically an extension of the ranger infrastructure. On the other hand, the path discovery bits could benefit from the watchful eye of the jump threading experts. Documenting the solver in a [ranger-tech] post is on my TODO list, as I think it would be useful as an example of GORI as a general tool, outside the VRP world. As I have mentioned elsewhere, I have gone through each test and documented the reasons why they were adjusted (when useful). The reviewer(s) may benefit from looking at the test notes. I have added a --param=threader-mode={ranger,legacy} option, which I hope to remove shortly after. It has been useful for diagnosing issues in the past, though perhaps not so much now. I've left it in case there's a remote interest in using it during stage1, but removing it could be a huge cleanup to tree-ssa-threadbackward.c. If/when accepted, I will open 2-3 PRs with the XFAILed tests as requested. I am still working on distilling a C counterpart for the libphobos missing thread edge. It'll hopefully be ready by the time the review is done. A version of this patchset with the verification code has been tested on x86-64, ppc64, ppc64le, and aarch64 (all Linux). I am currently re-testing on x86-64 Linux, but will not re-test on the rest of the architectures because...OMG aarch6 is so slow! Thanks. Aldy Aldy Hernandez (2): Implement basic block path solver. Backwards jump threader rewrite with ranger. gcc/Makefile.in | 6 + gcc/flag-types.h | 7 + gcc/params.opt | 17 + .../g++.dg/debug/dwarf2/deallocator.C | 3 +- gcc/testsuite/gcc.c-torture/compile/pr83510.c | 33 ++ gcc/testsuite/gcc.dg/Wrestrict-22.c | 3 + gcc/testsuite/gcc.dg/loop-unswitch-2.c | 2 +- gcc/testsuite/gcc.dg/old-style-asm-1.c | 5 +- gcc/testsuite/gcc.dg/pr68317.c | 4 +- gcc/testsuite/gcc.dg/pr97567-2.c | 2 +- gcc/testsuite/gcc.dg/predict-9.c | 4 +- gcc/testsuite/gcc.dg/shrink-wrap-loop.c | 53 ++ gcc/testsuite/gcc.dg/sibcall-1.c | 10 + .../gcc.dg/tree-ssa/builtin-sprintf-3.c | 5 +- gcc/testsuite/gcc.dg/tree-ssa/pr21001.c | 1 + gcc/testsuite/gcc.dg/tree-ssa/pr21294.c | 1 + gcc/testsuite/gcc.dg/tree-ssa/pr21417.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr21458-2.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr21563.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr49039.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr61839_1.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr61839_3.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr77445-2.c | 2 +- .../gcc.dg/tree-ssa/ranger-threader-1.c | 20 + .../gcc.dg/tree-ssa/ranger-threader-2.c | 39 ++ .../gcc.dg/tree-ssa/ranger-threader-3.c | 41 ++ .../gcc.dg/tree-ssa/ranger-threader-4.c | 83 +++ gcc/testsuite/gcc.dg/tree-ssa/split-path-4.c | 4 +- .../gcc.dg/tree-ssa/ssa-dom-thread-11.c | 2 +- .../gcc.dg/tree-ssa/ssa-dom-thread-12.c | 2 +- .../gcc.dg/tree-ssa/ssa-dom-thread-14.c | 1 + .../gcc.dg/tree-ssa/ssa-dom-thread-18.c | 5 +- .../gcc.dg/tree-ssa/ssa-dom-thread-6.c | 4 +- .../gcc.dg/tree-ssa/ssa-dom-thread-7.c | 1 + gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-48.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-11.c | 1 + gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-14.c | 1 + gcc/testsuite/gcc.dg/tree-ssa/vrp02.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp03.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp05.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp06.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp07.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp09.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp19.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp20.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp33.c | 2 +- gcc/testsuite/gcc.dg/vect/bb-slp-16.c | 7 + .../gcc.target/i386/avx2-vect-aggressive.c | 2 +- gcc/tree-ssa-path-solver.cc | 310 ++++++++++++ gcc/tree-ssa-path-solver.h | 85 ++++ gcc/tree-ssa-threadbackward.c | 475 +++++++++++++++++- gcc/tree-ssa-threadedge.c | 20 +- gcc/tree-ssa-threadedge.h | 3 +- gcc/tree-ssa-threadupdate.c | 12 +- gcc/tree-ssa-threadupdate.h | 2 +- .../libgomp.graphite/force-parallel-4.c | 1 + .../libgomp.graphite/force-parallel-8.c | 2 + 58 files changed, 1261 insertions(+), 54 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-1.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-2.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-3.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ranger-threader-4.c create mode 100644 gcc/tree-ssa-path-solver.cc create mode 100644 gcc/tree-ssa-path-solver.h -- 2.31.1