tree-optimization/111397 - missed copy propagation involving abnormal dest
commit92ea12ea99fce546772a40b7bbc2ea850db9b1be
authorRichard Biener <rguenther@suse.de>
Wed, 13 Sep 2023 07:28:34 +0000 (13 09:28 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 13 Sep 2023 08:20:31 +0000 (13 10:20 +0200)
treec9b1a3748b85db27eec16bcd3263fbc77dffd5cd
parentfeb23a37e6142016c3463aa3be3e900d45bc3ea5
tree-optimization/111397 - missed copy propagation involving abnormal dest

The following extends the previous enhancement to copy propagation
involving abnormals.  We can easily replace abnormal uses by not
abnormal uses and only need to preserve the abnormals in PHI arguments
flowing in from abnormal edges.  This changes the may_propagate_copy
argument indicating we are not propagating into a PHI node to indicate
whether we know we are not propagating into a PHI argument from an
abnormal PHI instead.

PR tree-optimization/111397
* tree-ssa-propagate.cc (may_propagate_copy): Change optional
argument to specify whether the PHI destination doesn't flow in
from an abnormal PHI.
(propagate_value): Adjust.
* tree-ssa-forwprop.cc (pass_forwprop::execute): Indicate abnormal
PHI dest.
* tree-ssa-sccvn.cc (eliminate_dom_walker::before_dom_children):
Likewise.
(process_bb): Likewise.

* gcc.dg/uninit-pr111397.c: New testcase.
gcc/testsuite/gcc.dg/uninit-pr111397.c [new file with mode: 0644]
gcc/tree-ssa-forwprop.cc
gcc/tree-ssa-propagate.cc
gcc/tree-ssa-sccvn.cc