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

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Philipp Tomsich <[email protected]>:

https://gcc.gnu.org/g:23b6a9a41a5c052f880f26b896357c5b207ca24a

commit r17-1845-g23b6a9a41a5c052f880f26b896357c5b207ca24a
Author: Konstantinos Eleftheriou <[email protected]>
Date:   Thu Jun 18 09:48:05 2026 +0200

    tail-merge: Combine conditions of merged blocks for ccmp [PR102793]

    After tail merging combines duplicate blocks, their predecessors
    branch to the same successor.  Combine the sequential conditions
    leading to the merged block using the ifcombine infrastructure; on
    targets with conditional compares this lets the backend emit ccmp.
    Whether combining is profitable is left to ifcombine's own cost model.

    The candidate selection identifies predecessor blocks of the merged
    block that have conditional branches, excluding the immediate
    dominator.  After the tail-merge loop completes, dominance info is
    (re)computed, SSA names that may be undefined are marked, and
    tree_ssa_ifcombine_bb is called for each candidate.

    Combining the scalar conditions that guard a loop would turn the
    loop's analyzable entry test into a boolean one, defeating the
    number-of-iterations analysis (and thus passes such as ivopts); extend
    ifcombine's existing niter-safety check to leave loop guards alone
    too.

    gcc/ChangeLog:

            PR tree-optimization/102793

            * tree-ssa-ifcombine.cc (bb_guards_loop_p): New function.
            (ifcombine_ifandif): Use it to avoid combining the conditions
            guarding a loop.
            * tree-ssa-tail-merge.cc: Include tree-ssa-ifcombine.h and
            tree-ssa.h.
            (ifcombine_candidate_bbs): New static bitmap.
            (apply_clusters): Collect the merged block's predecessors as
            ifcombine candidates.
            (tail_merge_optimize): Run tree_ssa_ifcombine_bb on the candidates;
            return TODO_cleanup_cfg when it changed the CFG.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/102793

            * g++.dg/tree-ssa/pr117123.C: --param
logical-op-non-short-circuit=0.
            * gcc.dg/tree-ssa/pr102793-1.c: New test.
            * gcc.dg/tree-ssa/pr102793-2.c: New test.
            * gcc.dg/uninit-pred-13.c: New test.
  • [Bug tree-optimization/102793] ... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to