diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2025-06-08 23:13:23 -0700 |
---|---|---|
committer | Andrew Pinski <andrew.pinski@oss.qualcomm.com> | 2025-08-08 14:30:28 -0700 |
commit | 899e7284bfa0b736165c3d9d5c18d5d883c5cbfb (patch) | |
tree | 6ff5464b75daaac60be1bb1c32d86f322bb3a018 /libjava/classpath/native/jni/java-net/javanet.c | |
parent | c7de7ddbfae1656ad8309f8821d17ae43383e5d5 (diff) | |
download | gcc-899e7284bfa0b736165c3d9d5c18d5d883c5cbfb.zip gcc-899e7284bfa0b736165c3d9d5c18d5d883c5cbfb.tar.gz gcc-899e7284bfa0b736165c3d9d5c18d5d883c5cbfb.tar.bz2 |
forwprop: Change proping memset into memcpy into a forwprop rather than a backwalk
One thing I noticed while working on copy prop for aggregates is that we start with
a memcpy like statement and then walk backwards. This means we could have a few walks
backwards to see there was no statement for zeroing. Instead this changes the walk
backwards into a true forwprop. In the future we can expand to forwprop the zeroing
into say an function argument or something more than memcpy like statement.
This should speed up slightly the compile time performance since there will be less
memsets like statements than memcpy and there is only one walk forwards for memset like
staments instead of multiple walk backwards to find the memset.
Note this does add one extra improvement, the memcpy now does not need to have an address
as its dest argument; this could have been done before too but it was even more noticable
now because of the variable became only set so it was removed and the check was removed
as well.
There is also a fix on how ao_ref for the memset/memcpy is done, before it was just using
ao_ref_init which is wrong since it should instead of used ao_ref_init_from_ptr_and_size.
This part fixes PR 121422.
Changes since v1:
* v2: Add back limit on the walk which was missed in v1.
Move the call to get_addr_base_and_unit_offset outside
of the vuse loop.
* v3: Remove extra check before the call to optimize_aggr_zeroprop_1.
Fix setting up of ao_ref for memset (PR121422).
PR tree-optimization/118946
PR tree-optimization/121422
gcc/ChangeLog:
* tree-ssa-forwprop.cc (optimize_memcpy_to_memset): Remove.
(optimize_aggr_zeroprop_1): New function.
(optimize_aggr_zeroprop): New function.
(simplify_builtin_call): Don't call optimize_memcpy_to_memset
for memcpy but call optimize_aggr_zeroprop for memset.
(pass_forwprop::execute): Don't call optimize_memcpy_to_memset
for aggregate copies but rather call optimize_aggr_zeroprop
for aggregate stores.
gcc/testsuite/ChangeLog:
* gcc.dg/pr118946-1.c: New test.
* gcc.dg/torture/pr121422-1.c: New test.
* gcc.dg/torture/pr121422-2.c: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'libjava/classpath/native/jni/java-net/javanet.c')
0 files changed, 0 insertions, 0 deletions