]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/115629 - missed tail merging
authorRichard Biener <rguenther@suse.de>
Tue, 25 Jun 2024 12:04:31 +0000 (14:04 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 26 Jun 2024 16:53:08 +0000 (18:53 +0200)
commit629257bcb81434117f1e9c68479032563176dc0c
treefd5ef42afc1c0dd042f3a0fdd583400711662de0
parent86a3dbeb6c6a36f8cf97c66cef83c9bc3ad82027
tree-optimization/115629 - missed tail merging

The following fixes a missed tail-merging observed for the testcase
in PR115629.  The issue is that when deps_ok_for_redirect doesn't
compute both would be valid prevailing blocks it rejects the merge.
The following instead makes sure to record the working block as
prevailing.  Also stmt comparison fails for indirect references
and is not handling memory references thoroughly, failing to unify
array indices and pointers indirected.  The following attempts to
fix this.

PR tree-optimization/115629
* tree-ssa-tail-merge.cc (gimple_equal_p): Handle
memory references better.
(deps_ok_for_redirect): Handle the case not both blocks
are considered a valid prevailing block.

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