Make last DCE remove empty loops
authorRichard Biener <rguenther@suse.de>
Thu, 10 Nov 2022 14:04:10 +0000 (15:04 +0100)
committerRichard Biener <rguenther@suse.de>
Fri, 11 Nov 2022 13:31:24 +0000 (14:31 +0100)
commitbe2c74fdcd0e8d66c3667008ba2561ab5dcc379b
tree091155704143fbac78105c27630499db30634b80
parent3b54cc9d04c2efb2c8f9a0b515e638917636630c
Make last DCE remove empty loops

The following makes the last DCE pass CD-DCE and in turn the
last CD-DCE pass a DCE one.  That ensues we remove empty loops
that become empty between the two.  I've also moved the tail-call
pass after DCE since DCE can only improve things here.

The two testcases were the only ones scanning cddce3 so I've
changed them to scan the dce7 pass that's now in this place.
The testcases scanning dce7 also work when that's in the earlier
position.

PR tree-optimization/84646
* tree-ssa-dce.cc (pass_dce::set_pass_param): Add param
wheter to run update-address-taken.
(pass_dce::execute): Honor it.
* passes.def: Exchange last DCE and CD-DCE invocations.
Swap pass_tail_calls and the last DCE.

* g++.dg/tree-ssa/pr106922.C: Continue to scan earlier DCE dump.
* gcc.dg/tree-ssa/20030808-1.c: Likewise.
gcc/passes.def
gcc/testsuite/g++.dg/tree-ssa/pr106922.C
gcc/testsuite/gcc.dg/tree-ssa/20030808-1.c
gcc/tree-ssa-dce.cc