]> git.ipfire.org Git - thirdparty/gcc.git/commit
forwprop: Copy prop aggregates into args
authorAndrew Pinski <quic_apinski@quicinc.com>
Tue, 10 Jun 2025 07:11:58 +0000 (00:11 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Thu, 14 Aug 2025 07:28:20 +0000 (00:28 -0700)
commitee67004474d521f7e107ec2795cfbb894a855c87
tree748181a9f1a9801e08e1f141bfd3187f8bb9929a
parent82d1617551aad498957cbbc0558001e2b24dc2f9
forwprop: Copy prop aggregates into args

This implements the simple copy prop of aggregates into
arguments of function calls. This can reduce the number of copies
done. Just like removing of an extra copy in general, this can and
will help out SRA; since we might not need to do a full scalarization
of the aggregate now.

This is the simpliest form of this copy prop of aggregates into function arguments.

Changes since v1:
* v2: Merge in the changes of r16-3160-g2fe432175ef135.
      Move the checks for assignment and call statement into optimize_agr_copyprop
      rather than having it in optimize_agr_copyprop_1 and optimize_agr_copyprop_arg.

gcc/ChangeLog:

* tree-ssa-forwprop.cc (optimize_agr_copyprop_1): New function split out of ...
(optimize_agr_copyprop): Here. Also try calling optimize_agr_copyprop_arg.
(optimize_agr_copyprop_arg): New function.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/copy-prop-aggregate-arg-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-arg-1.c [new file with mode: 0644]
gcc/tree-ssa-forwprop.cc