https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117142
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Martin Jambor
<jamb...@gcc.gnu.org>:

https://gcc.gnu.org/g:6244de432a5ba9807c6f0065e70a8025af7b1bd6

commit r13-9193-g6244de432a5ba9807c6f0065e70a8025af7b1bd6
Author: Martin Jambor <mjam...@suse.cz>
Date:   Fri Nov 15 14:37:06 2024 +0100

    tree-sra: Avoid SRAing arguments to a function returning_twice (PR 117142)

    This is a manual bacport of commit
    29d8f1f0b7ad3c69b3bdb130325300d5f73aa784 which must be done slightly
    elsewhere for gcc 13 and 12 because function
    build_access_from_call_arg was added only in gcc 14.

    But the gist of the patch is the same.  The commit message of the
    original fix says:

    PR 117142 shows that the current SRA probably never worked reliably
    with arguments passed to a function returning twice, because it then
    creates statements before the call which however needs to be at the
    beginning of a basic block.

    While it should be possible to make at least the case of passing
    arguments by value work with SRA (the statements would need to be put
    just on the non-abnormal edges leading to the BB), this would mean
    large surgery of function sra_modify_expr and I guess the time would
    better be spent re-organizing the whole pass.

    gcc/ChangeLog:

    2024-11-14  Martin Jambor  <mjam...@suse.cz>

            PR tree-optimization/117142
            * tree-sra.cc (scan_function): Disqualify any candidate passed to
            a function returning twice.

    gcc/testsuite/ChangeLog:

    2024-11-14  Martin Jambor  <mjam...@suse.cz>

            * gcc.dg/tree-ssa/pr117142.c: New test.

Reply via email to