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  <ja...@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

Reply via email to