On 10/4/26 5:24 AM, Aldy Hernandez wrote:
[Well, since we can't get rid of DOM yet, why don't we clean it up and
remove stuff we can clearly do better with ranges. Maybe we can
reduce it to a bare minimum ;-).]
We now have all the pieces to do what test_for_singularity does, but
with ranges. Remove the function and use simplify_using_ranges
instead.
This makes DOM a tiny bit smarter, since simplify_using_ranges is far
more capable than the ad-hoc stuff we did. As much as I hate making
it smarter, it's all in the interest of nuking it :).
Tested on ppc64le Linux.
OK for trunk?
gcc/ChangeLog:
* tree-ssa-dom.cc (dom_opt_dom_walker::m_dummy_cond): Remove.
(dom_opt_dom_walker::test_for_singularity): Remove.
(dom_opt_dom_walker::fold_cond): Remove.
(dom_opt_dom_walker::simplify_stmt): New.
(dom_opt_dom_walker::optimize_stmt): Call it in place of
test_for_singularity and fold_cond.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/predcom-7.c: Add -fno-tree-dominator-opts.
* gcc.dg/tree-ssa/ssa-dom-simplify-3.c: New test.
IIRC we've wanted to nuke this optimization as interacts poorly with SCEV.
Furthermore, the main purpose was to turn these things into equality
comparisons which in turn would expose the constant equivalence on one
of the edges, something done quite well by using Ranger already.
So no objection to the patch, but if you wanted to get a lot more
aggressive about this blob of code and nuke it, you've got my blessing.
jeff