This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] handle non-constant character assignments in strlen (PR 86083)
On 06/11/2018 12:06 PM, Martin Sebor wrote:
> On 06/11/2018 01:20 AM, Marc Glisse wrote:
>> On Sun, 10 Jun 2018, Martin Sebor wrote:
>>
>>> The attached patch implements this idea. (I looked for a simple
>>> function that returns true/false based on whether a SSA_NAME is
>>> or isn't definitely non-zero but couldn't find one so I created
>>> one though it seems that extending one of the existing functions
>>> might be a better approach?)
>>
>> tree_expr_nonzero_p (don't know why the comment above talks about
>> addresses), expr_not_equal_to.
>
> Thanks for the pointer! These are just what I was looking for.
> (I wonder if either a better naming convention or grouping all
> the declarations together in the same header would make them
> easier to find.)
>
> Attached is a simplified (virtually trivial) patch that uses
> tree_expr_nonzero_p instead, retested on x86_64-linux.
>
> Martin
>
> gcc-86083.diff
>
>
> PR tree-optimization/86083 - handle non-constant assignments in strlen
>
> gcc/ChangeLog:
>
> PR tree-optimization/86083
> * tree-ssa-strlen.c (handle_char_store): Use ree_expr_nonzero_p.
s/ree/tree/
>
> gcc/testsuite/ChangeLog:
>
> PR tree-optimization/86083
> * gcc.dg/strlenopt-44.c: New test.
OK with the ChangeLog nit fixed.
jeff