PR tree-optimization/83821 - local aggregate initialization defeats strlen optimization
authorMartin Sebor <msebor@redhat.com>
Wed, 16 Oct 2019 19:24:36 +0000 (19:24 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 16 Oct 2019 19:24:36 +0000 (13:24 -0600)
commit2fcb55d11f4167b966151057c121d0a47914c5c8
tree4a828418b3d87be6e4b4e53b6d73c3f3ed6e1de5
parent27c14dbc6b01d5b7238d9d6893bcddce19b7056c
PR tree-optimization/83821 - local aggregate initialization defeats strlen optimization

gcc/ChangeLog:

PR tree-optimization/83821
* tree-ssa-strlen.c (maybe_invalidate): Add argument.  Consider
the length of a string when available.
(handle_builtin_memset) Add argument.
(handle_store, strlen_check_and_optimize_call): Same.
(check_and_optimize_stmt): Same.  Pass it to callees.

gcc/testsuite/ChangeLog:

PR tree-optimization/83821
* c-c++-common/Warray-bounds-4.c: Remove XFAIL.
* gcc.dg/strlenopt-82.c: New test.
* gcc.dg/strlenopt-83.c: Same.
* gcc.dg/strlenopt-84.c: Same.
* gcc.dg/strlenopt-85.c: Same.
* gcc.dg/strlenopt-86.c: Same.
* gcc.dg/tree-ssa/calloc-4.c: Same.
* gcc.dg/tree-ssa/calloc-5.c: Same.

From-SVN: r277080
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Warray-bounds-4.c
gcc/testsuite/gcc.dg/strlenopt-82.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/strlenopt-83.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/strlenopt-84.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/strlenopt-85.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/strlenopt-86.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/calloc-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/calloc-5.c [new file with mode: 0644]
gcc/tree-ssa-strlen.c