From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123661 invoked by alias); 1 Aug 2016 11:33:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 123651 invoked by uid 89); 1 Aug 2016 11:33:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=re-use, Hx-languages-length:806, ideal X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Mon, 01 Aug 2016 11:33:54 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A62BBABF2; Mon, 1 Aug 2016 11:33:51 +0000 (UTC) Date: Mon, 01 Aug 2016 11:33:00 -0000 From: Richard Biener To: Prathamesh Kulkarni cc: gcc Patches Subject: Re: fold strlen (s) eq/ne 0 to *s eq/ne 0 on GIMPLE In-Reply-To: Message-ID: References: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2016-08/txt/msg00040.txt.bz2 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.