This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: fold strlen (s) eq/ne 0 to *s eq/ne 0 on GIMPLE
- From: Richard Biener <rguenther at suse dot de>
- To: Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>
- Cc: gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 1 Aug 2016 13:33:51 +0200 (CEST)
- Subject: Re: fold strlen (s) eq/ne 0 to *s eq/ne 0 on GIMPLE
- Authentication-results: sourceware.org; auth=none
- References: <CAAgBjM=VAMVeqB=Xey6_Y9Nohcp3nvLWdSNwd0p05yN=L2hiPw@mail.gmail.com>
On Mon, 1 Aug 2016, Prathamesh Kulkarni wrote:
> Hi Richard,
> The attached patch tries to fold strlen (s) eq/ne 0 to *s eq/ne 0 on GIMPLE.
> I am not sure where was the ideal place to put this transform in and ended up
> adding it to strlen_optimize_stmt().
> Does that look OK ?
>
> I needed to add TODO_update_ssa to strlen pass, otherwise we hit the
> following assert in execute_todo():
> if (flag_checking
> && cfun
> && need_ssa_update_p (cfun))
> gcc_assert (flags & TODO_update_ssa_any);
>
> Bootstrap+test in progress on x86_64-unknown-linux-gnu.
I believe you should factor small-size part of handle_builtin_memcmp and
re-use that for the code generation part.
You should also remove the corresponding fold-const.c code I think.
Richard.