The two two clobber can be considered the same.
So starting at `bb 4`'s. Bofore we walk back to the call of g statement
and would notice that the use in the phi node of `bb5` and that would cause
the walk to stop. But in this case since he phi node has a single use of the
clobber and the clobber matches the original clobber it can be considered the
same "one". So with the patch now, we walk back one more statement and allow it.
Similar to the at the call to p statement.
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/122247
gcc/ChangeLog:
* tree-ssa-forwprop.cc (do_simple_agr_dse): Allow phi node for the usage
if the usage of the phi result is just the "same" as the original clobber.
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/copy-prop-aggregate-sra-2.C: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>