This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Small load strlen opt follow-up improvement (PR tree-optimization/83444)
- From: Jeff Law <law at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 19 Dec 2017 14:03:42 -0700
- Subject: Re: [PATCH] Small load strlen opt follow-up improvement (PR tree-optimization/83444)
- Authentication-results: sourceware.org; auth=none
- References: <20171219172355.GU2353@tucnak>
On 12/19/2017 10:23 AM, Jakub Jelinek wrote:
> Hi!
>
> As the testcase shows, we weren't handling the case where we have
> _34 = MEM_REF[&b, 4B];
> - we would (if it exists) find the string length for b.a, but not
> for the second field. Using get_addr_stridx handles that well.
> The reason to use get_stridx on the MEM_REF first operand is to handle
> the case when the MEM_REF is based on SSA_NAME, that is something
> get_addr_stridx doesn't handle.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2017-12-19 Jakub Jelinek <jakub@redhat.com>
>
> PR tree-optimization/83444
> * tree-ssa-strlen.c (strlen_check_and_optimize_stmt): For the
> character load case, if get_stridx on MEM_REF's operand doesn't
> look usable, retry with get_addr_stridx.
>
> * gcc.dg/strlenopt-38.c: New test.
OK.
jeff