]> git.ipfire.org Git - thirdparty/gcc.git/commit
Improve sinking with unrelated defs
authorRichard Biener <rguenther@suse.de>
Wed, 26 Jul 2023 13:23:45 +0000 (15:23 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 3 Aug 2023 11:21:32 +0000 (13:21 +0200)
commit46c8c225455273ce7f7da7cc5707aed54f23e78d
tree6d2af8d18883c039ba376d316026d17a8ed6283c
parent021a0cd4494463026226a10d9556a0eedc422e5e
Improve sinking with unrelated defs

statement_sink_location for loads is currently confused about
stores that are not on the paths we are sinking across.  The
following replaces the logic that tries to ensure we are not
sinking across stores by instead of walking all immediate virtual
uses and then checking whether found stores are on the paths
we sink through with checking the live virtual operand at the
sinking location.  To obtain the live virtual operand we rely
on the new virtual_operand_live class which provides an overall
cheaper and also more precise way to check the constraints.

* tree-ssa-sink.cc: Include tree-ssa-live.h.
(pass_sink_code::execute): Instantiate virtual_operand_live
and pass it down.
(sink_code_in_bb): Pass down virtual_operand_live.
(statement_sink_location): Get virtual_operand_live and
verify we are not sinking loads across stores by looking up
the live virtual operand at the sink location.

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