This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Thoughts on memcmp expansion (PR43052)
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Bernd Schmidt <bschmidt at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Nick Clifton <nickc at redhat dot com>
- Date: Mon, 2 May 2016 15:14:09 +0200
- Subject: Re: Thoughts on memcmp expansion (PR43052)
- Authentication-results: sourceware.org; auth=none
- References: <56992541 dot 3090402 at redhat dot com> <CAFiYyc1NX9V9sM=cij75qAGYqGpXGM=1ZioB8cxWNZxsW=uJeQ at mail dot gmail dot com> <5722581B dot 5050402 at redhat dot com> <CAFiYyc3Nvb3Om81Fs6eGpc7oOkvQxJD7Qa_RP-AQh3x_-w-LRw at mail dot gmail dot com> <57274ECF dot 3060909 at redhat dot com>
On Mon, May 2, 2016 at 2:57 PM, Bernd Schmidt <bschmidt@redhat.com> wrote:
> On 05/02/2016 02:52 PM, Richard Biener wrote:
>>
>> +struct pieces_addr
>> +{
>> ...
>> + void *m_cfndata;
>> +public:
>> + pieces_addr (rtx, bool, by_pieces_constfn, void *);
>>
>> unless you strick private: somewhere the public: is redundant
>
>
> Yeah, ideally I want to turn these into a classes rather than structs. Maybe
> that particular one can already be done, but I'm kind of wondering how far
> to take the C++ification of the other one.
>
>> Index: gcc/tree-ssa-forwprop.c
>> ===================================================================
>> --- gcc/tree-ssa-forwprop.c (revision 235474)
>> +++ gcc/tree-ssa-forwprop.c (working copy)
>> @@ -1435,6 +1435,76 @@ simplify_builtin_call (gimple_stmt_itera
>> }
>> }
>> break;
>> +
>> + case BUILT_IN_MEMCMP:
>> + {
>>
>> I think this doesn't belong in forwprop. If we want to stick it into
>> a pass rather than
>> folding it should be in tree-ssa-strlen.c.
>
>
> This part (and the other one you quoted) was essentially your prototype
> patch from PR52171. I can put it whereever you like, really.
I think it fits best in tree-ssa-strlen.c:strlen_optimize_stmt for the moment.
>> Note that we can handle size-1 memcmp even for ordered compares.
>
>
> One would hope this doesn't occur very often...
C++ templates .... but yes.
Richard.
>
>> Jakub, where do you think this fits best? Note that gimple-fold.c may
>> not use immediate uses but would have to match this from the
>> comparison (I still have to find a way to handle this in match.pd where
>> the result expression contains virtual operands in the not toplevel stmt).
>
>
>
> Bernd