tree-optimization/97330 - fix bad load sinking
authorRichard Biener <rguenther@suse.de>
Thu, 8 Oct 2020 11:18:57 +0000 (13:18 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 8 Oct 2020 12:22:28 +0000 (14:22 +0200)
commit629e0547af33221a925f38757b52a9284148b68a
tree346ef3990a12adf0022f382cb1d920a47f5af6aa
parent2bdf324fb33d67f0850139040df0c0390258ab38
tree-optimization/97330 - fix bad load sinking

This fixes bad placement of sunk loads.

2020-10-08  Richard Biener  <rguenther@suse.de>

PR tree-optimization/97330
* tree-ssa-sink.c (statement_sink_location): Avoid skipping
PHIs when they dominate the insert location.

* gcc.dg/torture/pr97330-1.c: New testcase.
* gcc.dg/torture/pr97330-2.c: Likewise.
gcc/testsuite/gcc.dg/torture/pr97330-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr97330-2.c [new file with mode: 0644]
gcc/tree-ssa-sink.c