]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/111294 - better DCE after forwprop
authorRichard Biener <rguenther@suse.de>
Thu, 14 Sep 2023 07:31:23 +0000 (09:31 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 14 Sep 2023 11:15:10 +0000 (13:15 +0200)
commit9ea74d235c7e7816b996a17c61288f02ef767985
tree788217d9123e7e4dca940886495f91d8b21b9ea2
parent0f1f6cf872a03d82ab1973780b37bb8572e96f58
tree-optimization/111294 - better DCE after forwprop

The following adds more aggressive DCE to forwprop to clean up dead
stmts when folding a stmt leaves some operands unused.  The patch
uses simple_dce_from_worklist for this purpose, queueing original
operands before substitution and folding, but only if we folded the
stmt.

This removes one dead stmt biasing threading costs in a later pass
but it doesn't resolve the optimization issue in the PR yet.

PR tree-optimization/111294
* tree-ssa-forwprop.cc (pass_forwprop::execute): Track
operands that eventually become dead and use simple_dce_from_worklist
to remove their definitions if they did so.

* gcc.dg/tree-ssa/evrp10.c: Adjust.
* gcc.dg/tree-ssa/evrp6.c: Likewise.
* gcc.dg/tree-ssa/forwprop-31.c: Likewise.
* gcc.dg/tree-ssa/neg-cast-3.c: Likewise.
gcc/testsuite/gcc.dg/tree-ssa/evrp10.c
gcc/testsuite/gcc.dg/tree-ssa/evrp6.c
gcc/testsuite/gcc.dg/tree-ssa/forwprop-31.c
gcc/testsuite/gcc.dg/tree-ssa/neg-cast-3.c
gcc/tree-ssa-forwprop.cc