On 10/15/19 3:24 PM, Martin Sebor wrote:
> The attached patch removes a FIXME added recently to the strlen
> pass as a reminder to extend the handling of multi-byte stores
> of characters copied from non-constant strings with constant
> lengths to strings with non-constant lengths in some known range.
> For the string length range information it relies on the EVRP
> instance introduced into the pass with the sprintf integration
> and so far only used by sprintf.  (This is just a small first
> step in generalizing the strlen pass to take advantage of strlen
> ranges.)
> 
> Tested on x86_64-linux.
> 
> Martin
> 
> gcc-91996.diff
> 
> PR tree-optimization/91996 - fold non-constant strlen relational expressions
> 
> gcc/testsuite/ChangeLog:
> 
>       PR tree-optimization/91996
>       * gcc.dg/strlenopt-80.c: New test.
>       * gcc.dg/strlenopt-81.c: New test.
> 
> gcc/ChangeLog:
> 
>       PR tree-optimization/91996
>       * tree-ssa-strlen.c (maybe_warn_pointless_strcmp): Improve location
>       information.
>       (compare_nonzero_chars): Add an overload.
>       (count_nonzero_bytes): Add an argument.  Call overload above.
>       Handle non-constant lengths in some range.
>       (handle_store): Add an argument.
>       (check_and_optimize_stmt): Pass an argument to handle_store.
OK
jeff

Reply via email to