https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70232

--- Comment #16 from Jeffrey A. Law <law at redhat dot com> ---
So for thread paths noted in c#15 we have the following pieces of data

1. 69 statements to copy

2. 7 blocks to copy

3. Threads through latch, but does not create an irreducible loop

4. Eliminates a simple conditional branch, not a multiway branch


tree-ssa-threadbackwards is used for 2 cases.  Its first (and original) purpose
was to catch FSM loops.  Those are characterized by threading through the latch
and eliminating a multi-way branch at the end of path.  These are very
profitable and as such they allow for a lot of copying (100 statements).

The second case is as a replacement for the older forward-walking jump
threading done by VRP/DOM that we're phasing out.  These are less profitable
and have much lower copying thresholds.

#4 means that we've got the latter case.  But the code is not identifying it as
such.  The code tests !threaded_through_latch when it should be testing
!(threaded_through_latch && threaded_multiway_branch).

Fixing that results in all those threads around the loop being rejected as
needing too many statement copies.  Only two small/short jump threads are
realized.  All the undesirable copying is gone and we have a stack size of 140
bytes.

Reply via email to