Set ranges from unreachable edges for all known ranges.
authorAldy Hernandez <aldyh@redhat.com>
Fri, 23 Sep 2022 17:47:33 +0000 (19:47 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Mon, 26 Sep 2022 14:39:29 +0000 (16:39 +0200)
commit2460f7cdef7ef9c971de79271afc0db73687a272
treee7d32c60dcfffa2d34c713cb836269add5cdda3b
parente9019085e17554c209ca8531022f116b2d7f94fe
Set ranges from unreachable edges for all known ranges.

In the conversion of DOM+evrp to DOM+ranger, we missed that evrp was
exporting ranges for unreachable edges for all SSA names for which we
have ranges for.  Instead we have only been exporting ranges for the
SSA name in the final conditional to the BB involving the unreachable
edge.

This patch adjusts adjusts DOM to iterate over the exports, similarly
to what evrp was doing.

Note that I also noticed that we don't calculate the nonzero bit mask
for op1, when 0 = op1 & MASK.  This isn't needed for this PR,
since maybe_set_nonzero_bits() is chasing the definition and
parsing the bitwise and on its own.  However, I'll be adding the
functionality for completeness sake, plus we could probably drop the
maybe_set_nonzero_bits legacy call entirely.

PR tree-optimization/107009

gcc/ChangeLog:

* tree-ssa-dom.cc
(dom_opt_dom_walker::set_global_ranges_from_unreachable_edges):
Iterate over exports.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr107009.c: New test.
gcc/testsuite/gcc.dg/tree-ssa/pr107009.c [new file with mode: 0644]
gcc/tree-ssa-dom.cc