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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>:

https://gcc.gnu.org/g:045206450386bcd774db3bde0c696828402361c6

commit r12-5301-g045206450386bcd774db3bde0c696828402361c6
Author: Richard Biener <rguent...@suse.de>
Date:   Fri Nov 12 10:21:22 2021 +0100

    tree-optimization/102880 - improve CD-DCE

    The PR shows a missed control-dependent DCE caused by CFG cleanup
    merging a forwarder resulting in a partially degenerate PHI node.
    With control-dependent DCE we need to mark control dependences
    of incoming edges into PHIs as necessary but that is unnecessarily
    conservative for the case when two edges have the same value.
    There is no easy way to mark only a subset of control dependences
    of both edges necessary so the fix is to produce forwarder blocks
    where then the control dependence captures the requirements more
    precisely.

    For gcc.dg/tree-ssa/ssa-dom-thread-7.c the number of edges in the
    CFG decrease as we have commonized PHI arguments which in turn
    results in different threadings.  The testcase is too complex
    and the dump scanning too simple to do anything meaningful here
    but to adjust the number of expected threads.

    The same CFG massaging could be useful at RTL expansion time to
    reduce the number of copies we need to insert on edges.

    FAIL: gcc.dg/tree-ssa/ssa-hoist-4.c scan-tree-dump-times optimized
"MAX_EXPR" 1

    2021-11-12  Richard Biener  <rguent...@suse.de>

            PR tree-optimization/102880
            * tree-ssa-dce.c (sort_phi_args): New function.
            (make_forwarders_with_degenerate_phis): Likewise.
            (perform_tree_ssa_dce): Call
            make_forwarders_with_degenerate_phis.

            * gcc.dg/tree-ssa/pr102880.c: New testcase.
            * gcc.dg/tree-ssa/pr69270-3.c: Robustify.
            * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Change the number of
            expected threadings.

Reply via email to