]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-sra: Avoid SRAing arguments to a function returning_twice (PR 117142)
authorMartin Jambor <mjambor@suse.cz>
Wed, 23 Oct 2024 09:30:32 +0000 (11:30 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Wed, 23 Oct 2024 09:35:56 +0000 (11:35 +0200)
commit29d8f1f0b7ad3c69b3bdb130325300d5f73aa784
treec365fcb0c8137f0c2a3cf850f8d4d0291ba45e04
parent89c92804ea307ec807cc74c1cff4d3503452587a
tree-sra: Avoid SRAing arguments to a function returning_twice (PR 117142)

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-10-21  Martin Jambor  <mjambor@suse.cz>

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

gcc/testsuite/ChangeLog:

2024-10-21  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/117142
* gcc.dg/tree-ssa/pr117142.c: New test.
gcc/testsuite/gcc.dg/tree-ssa/pr117142.c [new file with mode: 0644]
gcc/tree-sra.cc