This is version 2 of the following patches:
https://inbox.sourceware.org/gcc-patches/[email protected]/
https://inbox.sourceware.org/gcc-patches/[email protected]/T/#u
For the memset patch, I had forgot to include the limit for the walker.
This has now been added back and some minor formating issues has been fixed.
The first one is unchanged; see below for stats.
The other 2 patches here are a bug fix for non-call exceptions and an
improvement dealing with zeroing case; recognizing integer zero stores
like a memset of zero (also vector and complex zeros).
As I mentioned the first patch makes it easier to prop not just into other
copy statements but into arguments and returns and even the possibility of
handling partial loads in the future.
As far as stats are concerned, the current copy prop for aggregates and this
one,
does not change code generation in many cases. Though this is only because SRA
was
handling these cases. Now what I have seen is in heavily C++ code, the number
of decls
created have decreased significantly. For an example while compiling highway's
benchmark
code, the number of decls created decreased over 2000; this is because SRA does
not need
to do a full scalarization for many of the copies.
Also the places where this has improved code generation is SRA is not doing
full scalarization
which made things worse.
Andrew Pinski (4):
forwprop: Change optimize_agr_copyprop into forward walk instead of
backwards
forwprop: Change proping memset into memcpy into a forwprop rather
than a backwalk
forwprop: Don't do copy-prop-aggregates from statements that could
throw [PR120599]
forwprop: Recongize a store of integral zero for
optimize_aggr_zeroprop.
gcc/testsuite/g++.dg/torture/noncall-eh-1.C | 26 ++
gcc/testsuite/gcc.dg/pr118946-1.c | 15 +
.../gcc.dg/torture/copy-prop-aggr-zero-1.c | 28 ++
.../gcc.dg/torture/copy-prop-aggr-zero-2.c | 28 ++
.../tree-ssa/copy-prop-aggregate-zero-1.c | 28 ++
.../tree-ssa/copy-prop-aggregate-zero-2.c | 25 ++
.../tree-ssa/copy-prop-aggregate-zero-3.c | 25 ++
gcc/tree-ssa-forwprop.cc | 425 ++++++++++--------
8 files changed, 413 insertions(+), 187 deletions(-)
create mode 100644 gcc/testsuite/g++.dg/torture/noncall-eh-1.C
create mode 100644 gcc/testsuite/gcc.dg/pr118946-1.c
create mode 100644 gcc/testsuite/gcc.dg/torture/copy-prop-aggr-zero-1.c
create mode 100644 gcc/testsuite/gcc.dg/torture/copy-prop-aggr-zero-2.c
create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-zero-1.c
create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-zero-2.c
create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-zero-3.c
--
2.43.0