This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Improve strlen pass handling of loads from memory (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: Mon, 18 Dec 2017 16:00:24 -0700
- Subject: Re: [PATCH] Improve strlen pass handling of loads from memory (PR tree-optimization/83444)
- Authentication-results: sourceware.org; auth=none
- References: <20171218214538.GI2353@tucnak>
On 12/18/2017 02:45 PM, Jakub Jelinek wrote:
> Hi!
>
> As the testcase shows, we fold strlen (str) == 0 into *str == 0 before
> the strlen pass has a chance to optimize. The following patch optimizes
> loads from the known termination '\0' into lhs = '\0' and loads from the
> part of the string known to be non-zero results in ~[0, 0] range being
> recorded if we don't have anything better.
>
> Note that unfortunately vrp2 doesn't consider any memory loads as
> interesting, even when they have non-varying ranges from other passes,
> but guess that is something to improve later.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2017-12-18 Jakub Jelinek <jakub@redhat.com>
>
> PR tree-optimization/83444
> * tree-ssa-strlen.c (strlen_check_and_optimize_stmt): Optimize
> character loads.
>
> * gcc.dg/strlenopt-36.c: New test.
OK.
jeff