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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>:

https://gcc.gnu.org/g:069caa5cea91fab3f1579ee1fdf50b923b75a6de

commit r16-1113-g069caa5cea91fab3f1579ee1fdf50b923b75a6de
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Thu Feb 20 22:05:38 2025 -0800

    gimple-fold: Implement simple copy propagation for aggregates [PR14295]

    This implements a simple copy propagation for aggregates in the similar
    fashion as we already do for copy prop of zeroing.

    Right now this only looks at the previous vdef statement but this allows us
    to catch a lot of cases that show up in C++ code.

    This used to deleted aggregate copies that are to the same location
(PR57361)
    But that was found to delete statements that are needed for aliasing
markers reason.
    So we need to keep them around until that is solved. Note DSE will delete
the statements
    anyways so there is no testcase added since we expose the latent bug in the
same way.
    See https://gcc.gnu.org/pipermail/gcc-patches/2025-May/685003.html for the
testcase and
    explaintation there.

    Also adds a variant of pr22237.c which was found while working on this
patch.

    Changes since v1:
    * v2: change check for vuse to use default definition.
          Remove dest/src arguments for optimize_agr_copyprop
          Changed dump messages slightly.
          Added stats
          Don't delete `a = a` until aliasing markers are added.

            PR tree-optimization/14295
            PR tree-optimization/108358
            PR tree-optimization/114169

    gcc/ChangeLog:

            * tree-ssa-forwprop.cc (optimize_agr_copyprop): New function.
            (pass_forwprop::execute): Call optimize_agr_copyprop for load/store
statements.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/20031106-6.c: Un-xfail. Add scan for forwprop1.
            * g++.dg/opt/pr66119.C: Disable forwprop since that does
            the copy prop now.
            * gcc.dg/tree-ssa/pr108358-a.c: New test.
            * gcc.dg/tree-ssa/pr114169-1.c: New test.
            * gcc.c-torture/execute/builtins/pr22237-1-lib.c: New test.
            * gcc.c-torture/execute/builtins/pr22237-1.c: New test.
            * gcc.dg/tree-ssa/pr57361.c: Disable forwprop1.
            * gcc.dg/tree-ssa/pr57361-1.c: New test.

    Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>

Reply via email to