This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3][middle-end]PR78809 (Inline strcmp with small constant strings)


> On Nov 16, 2017, at 6:57 PM, Jeff Law <law@redhat.com> wrote:
> 
> On 11/15/2017 08:00 AM, Qing Zhao wrote:
>> Hi,
>> 
>> this is the first patch for PR78809 (totally 3 patches)
>> 
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78809
>> inline strcmp with small constant strings
>> 
>> The design doc is at:
>> https://www.mail-archive.com/gcc@gcc.gnu.org/msg83822.html
>> 
>> this patch is for the first part of change:
>> 
>> A. for strncmp (s1, s2, n)
>>     if one of "s1" or "s2" is a constant string, "n" is a constant, and
>> larger than the length of the constant string:
>>     change strncmp (s1, s2, n) to strcmp (s1, s2);
>> 
>> adding test case strcmpopt_1.c into gcc.dg
>> 
>> bootstraped and tested on both X86 and aarch64. no regression.
>> 
>> Okay for commit?
>> 
>> thanks.
>> 
>> Qing
>> 
>> ======================
>> 
>> gcc/ChangeLog
>> 
>> 2017-11-15  Qing Zhao  <qing.zhao@oracle.com>
>> 
>>       * gimple-fold.c (gimple_fold_builtin_string_compare): Add handling
>>       of replacing call to strncmp with corresponding call to strcmp when
>>       meeting conditions.
>> 
>> gcc/testsuite/ChangeLog
>> 
>> 2017-11-15  Qing Zhao  <qing.zhao@oracle.com>
>> 
>>       PR middle-end/78809
>>       * gcc.dg/strcmpopt_1.c: New test.
> This is OK for the trunk.
> 
> Please put the PR middle-end/78809 marker in the main ChangeLog entry as
> well.

Okay.  (as following?)

2017-11-15  Qing Zhao <qing.zhao@oracle.com>

        PR middle-end/78809
        * gimple-fold.c (gimple_fold_builtin_string_compare): Add handling
        of replacing call to strncmp with corresponding call to strcmp when
        meeting conditions.


gcc/testsuite/ChangeLog

2017-11-15  Qing Zhao  <qing.zhao@oracle.com <mailto:qing.zhao@oracle.com>>

      PR middle-end/78809
      * gcc.dg/strcmpopt_1.c: New test.

> 
> Do you have write access to the repository?

No, I don’t have. 
Qing


> 
> jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]