]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR tree-optimization/78257 - missing memcmp optimization with constant arrays
authorMartin Sebor <msebor@redhat.com>
Fri, 14 Aug 2020 23:11:53 +0000 (17:11 -0600)
committerGiuliano Belinassi <giuliano.belinassi@usp.br>
Mon, 17 Aug 2020 18:08:14 +0000 (15:08 -0300)
commit8fa40c65f417914ac74fbc44243671d13d85b9f3
treebaa7dc09c75780c601edf10e8c2f995dc4abe160
parent27f2a40dadae86a9b6e1d0777dc4a0d99a3aee60
PR tree-optimization/78257 - missing memcmp optimization with constant arrays

gcc/ChangeLog:

PR middle-end/78257
* builtins.c (expand_builtin_memory_copy_args): Rename called function.
(expand_builtin_stpcpy_1): Remove argument from call.
(expand_builtin_memcmp): Rename called function.
(inline_expand_builtin_bytecmp): Same.
* expr.c (convert_to_bytes): New function.
(constant_byte_string): New function (formerly string_constant).
(string_constant): Call constant_byte_string.
(byte_representation): New function.
* expr.h (byte_representation): Declare.
* fold-const-call.c (fold_const_call): Rename called function.
* fold-const.c (c_getstr): Remove an argument.
(getbyterep): Define a new function.
* fold-const.h (c_getstr): Remove an argument.
(getbyterep): Declare a new function.
* gimple-fold.c (gimple_fold_builtin_memory_op): Rename callee.
(gimple_fold_builtin_string_compare): Same.
(gimple_fold_builtin_memchr): Same.

gcc/testsuite/ChangeLog:

PR middle-end/78257
* gcc.dg/memchr.c: New test.
* gcc.dg/memcmp-2.c: New test.
* gcc.dg/memcmp-3.c: New test.
* gcc.dg/memcmp-4.c: New test.
gcc/builtins.c
gcc/expr.c
gcc/expr.h
gcc/fold-const-call.c
gcc/fold-const.c
gcc/fold-const.h
gcc/gimple-fold.c
gcc/testsuite/gcc.dg/memchr.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/memcmp-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/memcmp-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/memcmp-4.c [new file with mode: 0644]