From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35515 invoked by alias); 29 Sep 2016 12:17:12 -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 35498 invoked by uid 89); 29 Sep 2016 12:17:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*M:online, Hx-languages-length:1188, AAA, H*M:19773 X-HELO: mailout08.t-online.de Received: from mailout08.t-online.de (HELO mailout08.t-online.de) (194.25.134.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Sep 2016 12:17:01 +0000 Received: from fwd29.aul.t-online.de (fwd29.aul.t-online.de [172.20.26.134]) by mailout08.t-online.de (Postfix) with SMTP id C2BB141D9749; Thu, 29 Sep 2016 14:16:57 +0200 (CEST) Received: from [192.168.0.16] (bdsAycZCwhRQEWB-P-08WX6jaj-UnI6V425TZt++0Pl9G++zjcTXnG+EqgmG2+WZij@[115.165.93.200]) by fwd29.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1bpaGj-2IiNk00; Thu, 29 Sep 2016 14:16:53 +0200 Message-ID: <1475151405.19773.18.camel@t-online.de> Subject: Re: [PATCH v3] Optimize strchr to strlen From: Oleg Endo To: Wilco Dijkstra , GCC Patches Cc: nd , Richard Biener , Jakub Jelinek Date: Thu, 29 Sep 2016 12:30:00 -0000 In-Reply-To: <1474639855.2578.2.camel@t-online.de> References: <1474639855.2578.2.camel@t-online.de> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg02234.txt.bz2 On Fri, 2016-09-23 at 23:10 +0900, Oleg Endo wrote: > On Fri, 2016-09-23 at 14:07 +0000, Wilco Dijkstra wrote: > > > > After discussion (https://gcc.gnu.org/ml/gcc-patches/2016-09/msg007 > > 18 > > .html) > > here is the latest version of the strchr patch.  This uses a gimple > > statement for > > the pointer addition so the gsi_prev always points at the strlen > > call. > > > > Optimize strchr (s, 0) to s + strlen (s).  strchr (s, 0) appears a > > common > > idiom for finding the end of a string, however it is not a very > > efficient > > way of doing so.  Strlen is a much simpler operation which is > > significantly > > faster (eg. on x86 strlen is 50% faster for strings of 8 bytes and > > about > > twice as fast as strchr on strings of 1KB). > > > > OK for commit? > Please add PR tree-optimization/61056 to the changelog so that it > gets linked in bugzilla. Notice that the "PR AAA/BBB" markers from the changelog should also be included in the SVN commit message.  Otherwise the bugzilla commit hook doesn't notice it, because it looks at the commit messages and not at the contents of the ChangeLog files. Cheers, Oleg