[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 --- Comment #26 from CVS Commits --- The releases/gcc-9 branch has been updated by Jason Merrill : https://gcc.gnu.org/g:dcb23017b1a9f65a81dbbe0f2b1a42999f7b2ac7 commit r9-8184-gdcb23017b1a9f65a81dbbe0f2b1a42999f7b2ac7 Author: Jason Merrill Date: Sun Jan 26 22:19:47 2020 -0500 c++: Fix array of char typedef in template (PR90966). Since Martin Sebor's patch for PR 71625 to change braced array initializers to STRING_CST in some cases, we need to be ready for STRING_CST with types that are changed by tsubst. fold_convert doesn't know how to deal with STRING_CST, which is reasonable; we really shouldn't expect it to here. So let's handle STRING_CST separately. PR c++/90966 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 --- Comment #25 from CVS Commits --- The master branch has been updated by Jason Merrill : https://gcc.gnu.org/g:8f25c39c454d7d3d323edf014a653649946352bd commit r10-6266-g8f25c39c454d7d3d323edf014a653649946352bd Author: Jason Merrill Date: Sun Jan 26 22:19:47 2020 -0500 c++: Fix array of char typedef in template (PR90966). Since Martin Sebor's patch for PR 71625 to change braced array initializers to STRING_CST in some cases, we need to be ready for STRING_CST with types that are changed by tsubst. fold_convert doesn't know how to deal with STRING_CST, which is reasonable; we really shouldn't expect it to here. So let's handle STRING_CST separately. PR c++/90966 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 --- Comment #24 from Steve Ellcey --- Author: sje Date: Fri Oct 5 15:26:40 2018 New Revision: 264874 URL: https://gcc.gnu.org/viewcvs?rev=264874=gcc=rev Log: 2018-10-05 Steve Ellcey PR tree-optimization/71625 * /gcc.target/aarch64/vclz.c (test_vclz_s8): Add noinline attribute. (test_vclz_s16): Ditto. (test_vclz_s32): Ditto. (test_vclzq_s8): Ditto. (test_vclzq_s16): Ditto. (test_vclzq_s32): Ditto. (test_vclz_u8): Ditto. (test_vclz_u16): Ditto. (test_vclz_u32): Ditto. (test_vclzq_u8): Ditto. (test_vclzq_u16): Ditto. (test_vclzq_u32): Ditto. * gcc.target/aarch64/vneg_s.c (test_vneg_s8): Ditto. (test_vneg_s16): Ditto. (test_vneg_s32): Ditto. (test_vneg_s64): Ditto. (test_vnegd_s64): Ditto. (test_vnegq_s8): Ditto. (test_vnegq_s16): Ditto. (test_vnegq_s32): Ditto. (test_vnegq_s64): Ditto. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.target/aarch64/vclz.c trunk/gcc/testsuite/gcc.target/aarch64/vneg_s.c
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 Martin Sebor changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #23 from Martin Sebor --- The optimization was implemented in r263511 and the fallout has been resolved.
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 --- Comment #22 from Martin Sebor --- The failures were discussed here: https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00863.html I'm afraid I'm not at all familiar with the details of these tests or even sufficiently versed in aarch64 assembly to change them as James suggested. I also don't have ready access to an aarch64 machine to verify changes to them (they are runtime tests and without ARM headers don't compile with a cross-compiler). If what it takes to avoid the failures is to disable inlining it should be easy enough to do but I have no way of validating the change.
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 Steve Ellcey changed: What|Removed |Added CC||sje at gcc dot gnu.org --- Comment #21 from Steve Ellcey --- Maybe this is already known but this patch: +2018-08-13 Martin Sebor + + PR tree-optimization/71625 + * c-common.c (braced_list_to_string): New function. + * c-common.h (braced_list_to_string): Declare it. + Caused two regressions on aarch64: FAIL: gcc.target/aarch64/vclz.c scan-assembler-times clz\\tv[0-9]+.16b, v[0-9]+.16b 2 FAIL: gcc.target/aarch64/vneg_s.c scan-assembler-times neg\\tv[0-9]+.16b, v[0-9]+.16b 1 FAIL: gcc.target/aarch64/vneg_s.c scan-assembler-times neg\\tv[0-9]+.8b, v[0-9]+.8b 1
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 Bernd Edlinger changed: What|Removed |Added CC||bernd.edlinger at hotmail dot de --- Comment #20 from Bernd Edlinger --- it is possible that the poly type returns now a different type class in __builtin_classify_type: @defmac __builtin_classify_type (@var{object}) Since each machine has its own conventions for which data types are passed in which kind of register, your implementation of @code{va_arg} has to embody these conventions. The easiest way to categorize the specified data type is to use @code{__builtin_classify_type} together with @code{sizeof} and @code{__alignof__}. @code{__builtin_classify_type} ignores the value of @var{object}, considering only its data type. It returns an integer describing what kind of type that is---integer, floating, pointer, structure, and so on. The file @file{typeclass.h} defines an enumeration that you can use to interpret the values of @code{__builtin_classify_type}. @end defmac builtins.c-/* Used by expand_builtin_classify_type and fold_builtin_classify_type. */ builtins.c- builtins.c-static enum type_class builtins.c-type_to_class (tree type) builtins.c-{ builtins.c- switch (TREE_CODE (type)) builtins.c-{ builtins.c-case VOID_TYPE: return void_type_class; builtins.c-case INTEGER_TYPE: return integer_type_class; builtins.c-case ENUMERAL_TYPE: return enumeral_type_class; builtins.c-case BOOLEAN_TYPE: return boolean_type_class; builtins.c-case POINTER_TYPE: return pointer_type_class; builtins.c-case REFERENCE_TYPE: return reference_type_class; builtins.c-case OFFSET_TYPE: return offset_type_class; builtins.c-case REAL_TYPE: return real_type_class; builtins.c-case COMPLEX_TYPE: return complex_type_class; builtins.c-case FUNCTION_TYPE: return function_type_class; builtins.c-case METHOD_TYPE: return method_type_class; builtins.c-case RECORD_TYPE: return record_type_class; builtins.c-case UNION_TYPE: builtins.c-case QUAL_UNION_TYPE: return union_type_class; builtins.c:case ARRAY_TYPE:return (TYPE_STRING_FLAG (type) builtins.c-? string_type_class : array_type_class); builtins.c-case LANG_TYPE: return lang_type_class; builtins.c-default:return no_type_class; builtins.c-} builtins.c-} builtins.c- builtins.c-/* Expand a call EXP to __builtin_classify_type. */ builtins.c- builtins.c-static rtx builtins.c-expand_builtin_classify_type (tree exp) builtins.c-{ builtins.c- if (call_expr_nargs (exp)) builtins.c-return GEN_INT (type_to_class (TREE_TYPE (CALL_EXPR_ARG (exp, 0; builtins.c- return GEN_INT (no_type_class); builtins.c-}
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 --- Comment #19 from nsz at gcc dot gnu.org --- Author: nsz Date: Fri Aug 17 17:26:11 2018 New Revision: 263624 URL: https://gcc.gnu.org/viewcvs?rev=263624=gcc=rev Log: Fix poly types after PR tree-optimization/71625 strlen optimization Same as r263561, but for arm: avoid compilation errors caused by poly initializers getting treated as string literals. Tested on arm-none-linux-gnueabihf. gcc/ChangeLog: * config/arm/arm-builtins.c (arm_init_simd_builtin_types): Clear polyNxK_t element's TYPE_STRING_FLAG. Modified: trunk/gcc/ChangeLog trunk/gcc/config/arm/arm-builtins.c
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 --- Comment #18 from Martin Sebor --- Author: msebor Date: Wed Aug 15 15:25:46 2018 New Revision: 263561 URL: https://gcc.gnu.org/viewcvs?rev=263561=gcc=rev Log: PR tree-optimization/71625 - missing strlen optimization on different array initialization style (avoid compilation errors on aarch64) gcc/ChangeLog: * config/aarch64/aarch64-builtins.c (aarch64_init_simd_builtin_types): Clear Poly8_t's TYPE_STRING_FLAG. Modified: trunk/gcc/ChangeLog trunk/gcc/config/aarch64/aarch64-builtins.c
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 --- Comment #17 from Martin Sebor --- Author: msebor Date: Mon Aug 13 17:57:51 2018 New Revision: 263511 URL: https://gcc.gnu.org/viewcvs?rev=263511=gcc=rev Log: PR tree-optimization/71625 - missing strlen optimization on different array initialization style gcc/c/ChangeLog: PR tree-optimization/71625 * c-parser.c (c_parser_declaration_or_fndef): Call braced_list_to_string. gcc/c-family/ChangeLog: PR tree-optimization/71625 * c-common.c (braced_list_to_string): New function. * c-common.h (braced_list_to_string): Declare it. gcc/cp/ChangeLog: PR tree-optimization/71625 * decl.c (check_initializer): Call braced_list_to_string. (eval_check_narrowing): New function. * gcc/cp/typeck2.c (digest_init_r): Accept strings literals as initilizers for all narrow character types. gcc/testsuite/ChangeLog: PR tree-optimization/71625 * g++.dg/init/string2.C: New test. * g++.dg/init/string3.C: New test. * g++.dg/init/string4.C: New test. * gcc.dg/init-string-3.c: New test. * gcc.dg/strlenopt-55.c: New test. * gcc.dg/strlenopt-56.c: New test. Added: trunk/gcc/testsuite/g++.dg/init/string2.C trunk/gcc/testsuite/g++.dg/init/string3.C trunk/gcc/testsuite/g++.dg/init/string4.C trunk/gcc/testsuite/gcc.dg/init-string-3.c trunk/gcc/testsuite/gcc.dg/strlenopt-55.c trunk/gcc/testsuite/gcc.dg/strlenopt-56.c Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-common.c trunk/gcc/c-family/c-common.h trunk/gcc/c/ChangeLog trunk/gcc/c/c-parser.c trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/cp/typeck2.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/c-c++-common/attr-nonstring-3.c
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 Martin Sebor changed: What|Removed |Added Keywords||patch --- Comment #16 from Martin Sebor --- Patch for the cases mentioned in comment #15: https://gcc.gnu.org/ml/gcc-patches/2018-07/msg01884.html
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 Martin Sebor changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org --- Comment #15 from Martin Sebor --- Testing a patch for the constant case: const char a[] = { 'a', 'b', 'c', 0 }; int f (void) { return __builtin_strlen (a); }
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 Richard Biener changed: What|Removed |Added Target Milestone|7.3 |7.4 --- Comment #14 from Richard Biener --- GCC 7.3 is being released, adjusting target milestone.
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 Richard Biener changed: What|Removed |Added Target Milestone|7.2 |7.3
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 Richard Biener changed: What|Removed |Added Target Milestone|7.2 7.2 |7.3 7.3 --- Comment #14 from Richard Biener --- GCC 7.2 is being released, adjusting target milestone. --- Comment #15 from Richard Biener --- GCC 7.2 is being released, adjusting target milestone.
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 Richard Biener changed: What|Removed |Added Target Milestone|7.2 7.2 |7.3 7.3 --- Comment #14 from Richard Biener --- GCC 7.2 is being released, adjusting target milestone. --- Comment #15 from Richard Biener --- GCC 7.2 is being released, adjusting target milestone.
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 Jakub Jelinek changed: What|Removed |Added Target Milestone|7.0 |7.2 --- Comment #13 from Jakub Jelinek --- GCC 7.1 has been released.
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 --- Comment #12 from Jakub Jelinek --- Martin, the changes you wanted to do are desirable in any case. The changes I've committed don't fix this, they are just preparation for further changes that might help. But there still would be the suboptimal code generation for the { 'a', 'b', 'c', '\0' }; style initialization.
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 --- Comment #11 from Jakub Jelinek --- Author: jakub Date: Wed Jun 29 08:47:46 2016 New Revision: 237841 URL: https://gcc.gnu.org/viewcvs?rev=237841=gcc=rev Log: PR tree-optimization/71625 * tree-ssa-strlen.c (get_addr_stridx): Add PTR argument. Assume list is sorted by ascending list->offset. If PTR is non-NULL and there is previous strinfo, call get_stridx_plus_constant. (get_stridx): Pass exp as second argument to get_addr_stridx. (addr_stridxptr): Add missing list = list->next, so that there can be more than one entries in the list. Bump limit from 16 to 32. Ensure the list is sorted by ascending list->offset. (get_stridx_plus_constant): Adjust so that it can be also called with ADDR_EXPR instead of SSA_NAME as PTR. (handle_char_store): Pass NULL_TREE as second argument to get_addr_stridx. * gcc.dg/strlenopt-28.c: New test. Added: trunk/gcc/testsuite/gcc.dg/strlenopt-28.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-strlen.c
[Bug tree-optimization/71625] missing strlen optimization on different array initialization style
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71625 Jakub Jelinek changed: What|Removed |Added Component|middle-end |tree-optimization Version|tree-ssa|7.0 Target Milestone|--- |7.0