diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-11-30 11:30:08 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2024-11-30 11:30:08 +0100 |
commit | 6bebb3b0f3fa422d248a1c2075da0598a44c7320 (patch) | |
tree | e1ef368d0ea217a495eee1bcad10dc62e5e25902 /libgcc/libgcc2.h | |
parent | f089ef880e385e2193237b1f53ec81dac4141680 (diff) | |
download | gcc-6bebb3b0f3fa422d248a1c2075da0598a44c7320.zip gcc-6bebb3b0f3fa422d248a1c2075da0598a44c7320.tar.gz gcc-6bebb3b0f3fa422d248a1c2075da0598a44c7320.tar.bz2 |
strlen: Handle vector CONSTRUCTORs [PR117057]
The following patch handles VECTOR_TYPE_P CONSTRUCTORs in
count_nonzero_bytes, including handling them if they have some elements
non-constant.
If there are still some constant elements before it (in the range queried),
we derive info at least from those bytes and consider the rest as unknown.
The first 3 hunks just punt in IMHO problematic cases, the spaghetti code
considers byte_size 0 as unknown size, determine yourself, so if offset
is equal to exp size, there are 0 bytes to consider (so nothing useful
to determine), but using byte_size 0 would mean use any size.
Similarly, native_encode_expr uses int type for offset (and size), so
padding it offset larger than INT_MAX could be silent miscompilation.
I've guarded the test to just a couple of targets known to handle it,
because e.g. on ia32 without -msse forwprop1 seems to lower the CONSTRUCTOR
into 4 BIT_FIELD_REF stores and I haven't figured out on what exactly
that depends on (e.g. powerpc* is fine on any CPUs, even with -mno-altivec
-mno-vsx, even -m32).
2024-11-30 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/117057
* tree-ssa-strlen.cc (strlen_pass::count_nonzero_bytes): Punt also
when byte_size is equal to offset or nchars. Punt if offset is bigger
than INT_MAX. Handle vector CONSTRUCTOR with some elements constant,
possibly followed by non-constant.
* gcc.dg/strlenopt-32.c: Remove xfail and vect_slp_v2qi_store_unalign
specific scan-tree-dump-times directive.
* gcc.dg/strlenopt-96.c: New test.
Diffstat (limited to 'libgcc/libgcc2.h')
0 files changed, 0 insertions, 0 deletions