]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/106922 - PRE and virtual operand translation
authorRichard Biener <rguenther@suse.de>
Thu, 15 Sep 2022 11:33:23 +0000 (13:33 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 11 Oct 2022 11:23:45 +0000 (13:23 +0200)
commite364e27b6636ba09755790358910f199d07194b3
tree5c298c3a7df9dbf9a2cece35a9081b3617af5360
parent2b9e1f7ff476059724cca4b11d39972655d4468f
tree-optimization/106922 - PRE and virtual operand translation

PRE implicitely keeps virtual operands at the blocks incoming version
but the explicit updating point during PHI translation fails to trigger
when there are no PHIs at all in a block.  Later lazy updating then
fails because of a too lose block check.  A similar issues plagues
reference invalidation when checking the ANTIC_OUT to ANTIC_IN
translation.  The following fixes both and makes the lazy updating
work.

The diagnostic testcase unfortunately requires boost so the
testcase is the one I reduced for a missed optimization in PRE.
The testcase fails with -m32 on x86_64 because we optimize too
much before PRE which causes PRE to not trigger so we fail to
eliminate a full redundancy.  I'm going to open a separate bug
for this.  Hopefully the !lp64 selector is good enough.

PR tree-optimization/106922
* tree-ssa-pre.cc (translate_vuse_through_block): Only
keep the VUSE if its def dominates PHIBLOCK.
(prune_clobbered_mems): Rewrite logic so we check whether
a value dies in a block when the VUSE def doesn't dominate it.

* g++.dg/tree-ssa/pr106922.C: New testcase.

(cherry picked from commit 5edf02ed2b6de024f83a023d046a6a18f645bc83)
gcc/testsuite/g++.dg/tree-ssa/pr106922.C [new file with mode: 0644]
gcc/tree-ssa-pre.cc