]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/121220 - improve sinking of stores
authorRichard Biener <rguenther@suse.de>
Wed, 23 Jul 2025 07:40:24 +0000 (09:40 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 23 Jul 2025 10:46:22 +0000 (12:46 +0200)
commit44b24b62a44e6208d654513cf567dd6900a2fb56
tree981f46a747297c45c4ed10db4e1d4f2a92d895eb
parentdb8b92d8d61de408e14a4aebf5a777734936699d
tree-optimization/121220 - improve sinking of stores

We currently do only very restricted store sinking into paths
that have no loads or stores and end in a virtual PHI.  The
following extends this to sink towards a single virtual
definition in addition to the case of a PHI, handling skipping
of unrelated virtual uses.  We later have to prune cases
that would require virtual PHI insertion and the patch below
basically restricts this to sinking to noreturn paths for now.

PR tree-optimization/121220
* tree-ssa-sink.cc (statement_sink_location): For stores
handle sinking to paths ending in a store.  Skip loads
that do not use the store.

* gcc.dg/tree-ssa/ssa-sink-23.c: New testcase.
gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-23.c [new file with mode: 0644]
gcc/tree-ssa-sink.cc