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

--- Comment #11 from GCC 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:8c67dc40459e3d72e8169b099cc8c5dbdb759da3

commit r15-2133-g8c67dc40459e3d72e8169b099cc8c5dbdb759da3
Author: Richard Biener <rguent...@suse.de>
Date:   Wed Jul 17 10:22:47 2024 +0200

    tree-optimization/104515 - store motion and clobbers

    The following addresses an old regression when end-of-object/storage
    clobbers were introduced.  In particular when there's an end-of-object
    clobber in a loop but no corresponding begin-of-object we can still
    perform store motion of may-aliased refs when we re-issue the
    end-of-object/storage on the exits but elide it from the loop.  This
    should be the safest way to deal with this considering stack-slot
    sharing and it should not cause missed dead store eliminations given
    DSE can now follow multiple paths in case there are multiple exits.

    Note when the clobber is re-materialized only on one exit but not
    on anther we are erroring on the side of removing the clobber on
    such path.  This should be OK (removing clobbers is always OK).

    Note there's no corresponding code to handle begin-of-object/storage
    during the hoisting part of loads that are part of a store motion
    optimization, so this only enables stored-only store motion or cases
    without such clobber inside the loop.

            PR tree-optimization/104515
            * tree-ssa-loop-im.cc (execute_sm_exit): Add clobbers_to_prune
            parameter and handle re-materializing of clobbers.
            (sm_seq_valid_bb): end-of-storage/object clobbers are OK inside
            an ordered sequence of stores.
            (sm_seq_push_down): Refuse to push down clobbers.
            (hoist_memory_references): Prune clobbers from the loop body
            we re-materialized on an exit.

            * g++.dg/opt/pr104515.C: New testcase.

Reply via email to