cd_dce: Return TODO_update_address_taken from last cd_dce [PR96271]
authorJakub Jelinek <jakub@redhat.com>
Sat, 16 Jan 2021 08:17:38 +0000 (09:17 +0100)
committerJakub Jelinek <jakub@redhat.com>
Sat, 16 Jan 2021 08:20:29 +0000 (09:20 +0100)
commitb673e7547fb95d1f0d5cd17ae9e3874742cade66
tree902a5f562ddc765c1e4788ea54154f00aba50733
parent2c356f221bbab29bf4d1626d161e0f584dddd600
cd_dce: Return TODO_update_address_taken from last cd_dce [PR96271]

On the following testcase, handle_builtin_memcmp in the strlen pass folds
the memcmp into comparison of two MEM_REFs.  But nothing triggers updating
of addressable vars afterwards, so even when the parameters are no longer
address taken, we force the parameters to stack and back anyway.

This patch causes TODO_update_address_taken to happen right before last forwprop
pass (at the end of last cd_dce), so after strlen1 too.

2021-01-16  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/96271
* passes.def: Pass false argument to first two pass_cd_dce
instances and true to last instance.  Add comment that
last instance rewrites no longer addressed locals.
* tree-ssa-dce.c (pass_cd_dce): Add update_address_taken_p member and
initialize it.
(pass_cd_dce::set_pass_param): New method.
(pass_cd_dce::execute): Return TODO_update_address_taken from
last cd_dce instance.

* gcc.target/i386/pr96271.c: New test.
gcc/passes.def
gcc/testsuite/gcc.target/i386/pr96271.c [new file with mode: 0644]
gcc/tree-ssa-dce.c