https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127754

--- Comment #3 from hr.jonas.hansen at gmail dot com ---
See https://forge.sourceware.org/gcc/gcc/pulls/237 for context.

The character-array version no longer exercises the original partial-DSE
optimization. In the latest revision, I've kept that program in
ssa-dse-1.C with a check for deletion of the redundant whole-object
clear, and added the enum version as ssa-dse-4.C with the original
partial-DSE assertion. The character-array check does not establish the
efficiency of the later expansion.

I compared the original character-array program before PR127416 and
with this follow-up at -O1, using buffer sizes of 200, 4096, 65536 and
1048576 bytes. These comparisons use the existing x86_64 and Cortex-M0
builds, rather than a fresh build of today's trunk.

For the 200-byte x86_64 case, I reproduce the change from a zeroing loop
to individual stores. For all three larger sizes, however, the follow-up
stores the first 32 bytes and calls memset for the remaining size - 32
bytes. On Cortex-M0 it copies 33 bytes and calls memset for the remaining
size - 33 bytes, including the 200-byte case. The generated instruction
sequence therefore does not grow with the larger buffer sizes in these
checks.

I haven't measured execution time, so this does not establish equivalent
performance. Could you share the target, compiler options and buffer size
for the inefficient expansion you observed, so I can reproduce that case?

Both DSE tests pass on x86_64 and Cortex-M0. The enum assertion also fails
when partial DSE is disabled, confirming that its original optimization
coverage is retained.

Reply via email to