On 8/2/23 06:44, Richard Biener via Gcc-patches wrote:
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. Bootstrapped and tested on x86_64-unknown-linux-gnu. Comments? Thanks, Richard. * 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.
LGTM. jeff