tree-optimization/113080 - missing final value replacement
commitafd49e663258061a10f0f2c4a8f8aa2bf97bee42
authorRichard Biener <rguenther@suse.de>
Tue, 19 Dec 2023 09:51:06 +0000 (19 10:51 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 19 Dec 2023 12:31:30 +0000 (19 13:31 +0100)
treef8c33d05c9feb6796c1c7c54b463b5492a84eac1
parentaa2a48984c3d8c7a6a6da10d924e030b141b44cd
tree-optimization/113080 - missing final value replacement

When performing final value replacement we guard against exponential
(temporary) code growth due to unsharing of trees (SCEV heavily
relies on tree sharing).  The following relaxes this a tiny bit
to cover some more optimizations and puts in comments as to what
the real fix would be.

PR tree-optimization/113080
* tree-scalar-evolution.cc (expression_expensive_p): Allow
a tiny bit of growth due to expansion of shared trees.
(final_value_replacement_loop): Add comment.

* gcc.dg/tree-ssa/sccp-3.c: New testcase.
gcc/testsuite/gcc.dg/tree-ssa/sccp-3.c [new file with mode: 0644]
gcc/tree-scalar-evolution.cc