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

--- Comment #28 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jakub Jelinek
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:4320e8483bb88b49bf251451307324c06d33c0a4

commit r13-8521-g4320e8483bb88b49bf251451307324c06d33c0a4
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Sat Mar 23 11:17:44 2024 +0100

    predcom: Punt for steps which aren't multiples of access size [PR111683]

    On the following testcases, there is no overlap between data references
    within a single iteration, but the data references have size which is twice
    as large as the step, which means the data references overlap with the next
    iteration which predcom doesn't take into account.
    As discussed in the PR, even if the reference size is smaller than step,
    if step isn't a multiple of the reference size, there could be overlaps
with
    some other iteration later on.
    The initial version of the patch regressed (test still passed, but predcom
    didn't optimize anymore) pr71083.c which has a packed char, short structure
    and was reading/writing the short 2 bytes in there with step 3.
    The following patch deals with that by retrying for COMPONENT_REFs also the
    aggregate sizes etc., so that it then compares 3 bytes against step 3.
    In make check-gcc/check-g++ this patch I believe affects code generation
    for only the 2 new testcases according to statistics I've gathered.

    2024-03-23  Jakub Jelinek  <ja...@redhat.com>

            PR middle-end/111683
            * tree-predcom.cc (pcom_worker::suitable_component_p): If has_write
            and comp_step is RS_NONZERO, return false if any reference in the
            component doesn't have DR_STEP a multiple of access size.

            * gcc.dg/pr111683-1.c: New test.
            * gcc.dg/pr111683-2.c: New test.

    (cherry picked from commit 8fc5593df8e0d36cc5bd8ea21097a491a634a866)

Reply via email to