On 8/24/2026 2:01 PM, Andrea Pinski wrote:
On Mon, Aug 24, 2026 at 12:25 PM Aldy Hernandez <[email protected]> wrote:
On Mon, Aug 24, 2026 at 11:17:09AM -0600, Jeffrey Law wrote:
On 8/24/2026 7:03 AM, Aldy Hernandez wrote:
[Richi, per your suggestion...is this what you had in mind?]
DOM's jump threader duplicates a join block that merges comparisons
into a boolean that is immediately tested:
<bb 3>:
t_9 = a < b;
goto <bb 5>;
<bb 4>:
t_6 = c < d;
goto <bb 5>;
<bb 5>:
# t_1 = PHI <t_9(3), t_6(4)>
if (t_1 != 0)
Jeez. More stuff I don't remember adding. Presumably the goal here is to
duplicate the test from bb5 into bb3 and change it to test a < b and a
similar transformation in bb4 testing c < d which likely happens after DOM
was run. It probably opens up potential threading opportunities as well.
You can't remember cause it wasn't you ;-):
commit 1d53751dd563d30e4400e4a2da530d8ea07da44b
Author: Jiufu Guo <[email protected]>
Date: Thu Jun 13 18:55:55 2019 +0000
re PR tree-optimization/77820 (A jump threading opportunity with
conditionals)
Looking into the history of at least PR 37537 (which is marked as a
dup of PR 77820); this originally showed up in spec cpu 2000's facerec
benchmark. Though it seems like the gfortran front-end was changed to
prevent creating this (by Jakub). Though I don't know where Segher
got the idea for PR 77820; (see below link where he mentioned SPEC CPU
2006 or so; but I think it was the same thing I had looked at
earlier).
So it was originally posted as its own pass even:
https://gcc.gnu.org/pipermail/gcc-patches/2019-May/521049.html
Just reviewed that thread. I have zero recollection at all of that part
of the thread either :-) But all the discussion basically makes
sense. Kind of funny that we pondered doing this in phiopt, but
ultimately implemented in DOM's threader, now we're going back and
looking at it for phiopt again.....
Anyway, this is good for trunk. I would suggest exploring if there's
any negativce fallout from running it unconditionally rather than gated
on !early as a follow-up.
jeff