This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][Middle-end][version 3]3rd patch of PR78809
- From: Jeff Law <law at redhat dot com>
- To: Qing Zhao <qing dot zhao at oracle dot com>, martin Sebor <msebor at gmail dot com>
- Cc: gcc Patches <gcc-patches at gcc dot gnu dot org>, richard Biener <rguenther at suse dot de>, jakub Jelinek <jakub at redhat dot com>
- Date: Thu, 12 Jul 2018 11:03:20 -0600
- Subject: Re: [PATCH][Middle-end][version 3]3rd patch of PR78809
- References: <4A83BDE4-1FDE-40E5-9526-A907D2170DF0@oracle.com> <cf3488f8-8e30-ee6d-c7a6-638a2c204416@redhat.com> <A5AA2AB3-12CF-4830-BE57-0F4065CEC856@oracle.com> <A29F917A-F269-4E87-9881-361B32A90A2E@oracle.com>
On 07/11/2018 04:03 PM, Qing Zhao wrote:
> Hi, This is the 3rd version of the patch for the last part of PR78809.
>
> the major change in this version is to address the following concerns raised by Martin:
>
>> One of the basic design principles that I myself have
>> accidentally violated in the past is that warning options
>> should not impact the emitted object code. I don't think
>> your patch actually does introduce this dependency by having
>> the codegen depend on the result of check_access() -- I'm
>> pretty sure the function is designed to do the validation
>> irrespective of warning options and return based on
>> the result of the validation and not based on whether
>> a warning was issued. But the choice of the variable name,
>> no_overflow_warn, suggests that it does, in fact, have this
>> effect. So I would suggest to rename the variable and add
>> a test that verifies that this dependency does not exist.
> I have addressed this concern as following per our discussion:
>
> 1. in routine expand_builtin_memcmp,
> * delete the condition if (warn_stringop_overflow) before check_access;
> * change the name of the variable that holds the return value of check_access to no_overflow
>
> 2. in the testsuite, change the new testcase strcmpopt_6.c to inhibit inlining when check_access
> detects error (Not depend on whether the warning option is ON or not).
>
> the following is the new patch, tested on both X86 and aarch64, no regression.
>
> Okay for thunk?
>
> thanks.
>
> Qing
>
> gcc/ChangeLog:
>
> +2018-07-11 Qing Zhao <qing.zhao@oracle.com>
> +
> + PR middle-end/78809
> + * builtins.c (expand_builtin_memcmp): Inline the calls first
> + when result_eq is false.
> + (expand_builtin_strcmp): Inline the calls first.
> + (expand_builtin_strncmp): Likewise.
> + (inline_string_cmp): New routine. Expand a string compare
> + call by using a sequence of char comparison.
> + (inline_expand_builtin_string_cmp): New routine. Inline expansion
> + a call to str(n)cmp/memcmp.
> + * doc/invoke.texi (--param builtin-string-cmp-inline-length): New option.
> + * params.def (BUILTIN_STRING_CMP_INLINE_LENGTH): New.
> +
>
> gcc/testsuite/ChangeLog:
>
> +2018-07-11 Qing Zhao <qing.zhao@oracle.com>
> +
> + PR middle-end/78809
> + * gcc.dg/strcmpopt_5.c: New test.
> + * gcc.dg/strcmpopt_6.c: New test.
OK
THanks
Jeff