]> git.ipfire.org Git - thirdparty/gcc.git/commit
SRA: Limit replacement creation for accesses propagated from LHSs
authorMartin Jambor <mjambor@suse.cz>
Wed, 16 Nov 2022 12:11:27 +0000 (13:11 +0100)
committerMartin Jambor <mjambor@suse.cz>
Wed, 16 Nov 2022 12:12:40 +0000 (13:12 +0100)
commit985a8962712a56d1c9418cf05e1761f8bd20cf8f
tree35aa695d7288cb44356d5989d227daa92baddde1
parentbdcacfd5ad5b0f88d035f3618de969cea11dc5d3
SRA: Limit replacement creation for accesses propagated from LHSs

PR 107206 is fallout from the fix to PR 92706 where we started
propagating accesses across assignments also from LHS to RHS of
assignments so that we would not do harmful total scalarization of the
aggregates on the RHS.

But this can lead to new scalarization of these aggregates and in the
testcase of PR 107206 these can appear in superfluous uses of
un-initialized values and spurious warnings.

Fixed by making sure the the accesses created by propagation in this
direction are only used as a basis for replacements when the structure
would be totally scalarized anyway.

gcc/ChangeLog:

2022-10-18  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/107206
* tree-sra.cc (struct access): New field grp_result_of_prop_from_lhs.
(analyze_access_subtree): Do not create replacements for accesses with
this flag when not toally scalarizing.
(propagate_subaccesses_from_lhs): Set the new flag.

gcc/testsuite/ChangeLog:

2022-10-18  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/107206
* g++.dg/tree-ssa/pr107206.C: New test.

(cherry picked from commit f6c168f8c06047bfaa3005e570126831b8855dcc)
gcc/testsuite/g++.dg/tree-ssa/pr107206.C [new file with mode: 0644]
gcc/tree-sra.cc