From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64862 invoked by alias); 28 Sep 2016 15:43:30 -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 63869 invoked by uid 89); 28 Sep 2016 15:43:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=H*RU:sk:mail-ve, Hx-spam-relays-external:sk:mail-ve X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Sep 2016 15:43:18 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-ve1eur03lp0152.outbound.protection.outlook.com [213.199.154.152]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-59-wj3BBXJtNpuY4HuFoLqAcg-1; Wed, 28 Sep 2016 16:43:15 +0100 Received: from AM5PR0802MB2610.eurprd08.prod.outlook.com (10.175.46.18) by AM5PR0802MB2609.eurprd08.prod.outlook.com (10.175.46.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Wed, 28 Sep 2016 15:43:14 +0000 Received: from AM5PR0802MB2610.eurprd08.prod.outlook.com ([10.175.46.18]) by AM5PR0802MB2610.eurprd08.prod.outlook.com ([10.175.46.18]) with mapi id 15.01.0649.016; Wed, 28 Sep 2016 15:43:14 +0000 From: Wilco Dijkstra To: Jason Merrill CC: GCC Patches , nd Subject: Re: [PATCH v3] Optimize strchr to strlen Date: Wed, 28 Sep 2016 15:46:00 -0000 Message-ID: References: <1474639855.2578.2.camel@t-online.de> , In-Reply-To: x-ms-office365-filtering-correlation-id: 37c897ff-32c9-4066-3891-08d3e7b628c5 x-microsoft-exchange-diagnostics: 1;AM5PR0802MB2609;20:gA+j45ZuhN3yjTGi2TyxhBtbhLPzjjkWLuZ0xV/jQNoc82hrweA6FMUI6Xj+EdljppwF/LJUo6rGVY8rJ/TZ9Ed6yRYUNsoCbZP5VOxtb6aFCMvKCRA49dzwzfXVrJOYIHXcH6EAyAWkVQ19HyVGbnKzb4MS6KSHsN03DDNgHjM= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0802MB2609; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026);SRVR:AM5PR0802MB2609;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0802MB2609; x-forefront-prvs: 0079056367 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(7916002)(199003)(189002)(24454002)(377424004)(81156014)(81166006)(66066001)(6916009)(2950100002)(97736004)(8676002)(4326007)(93886004)(7696004)(74316002)(122556002)(586003)(11100500001)(19580395003)(3846002)(19580405001)(102836003)(87936001)(76576001)(10400500002)(110136003)(6116002)(3280700002)(77096005)(54356999)(5002640100001)(189998001)(3660700001)(2900100001)(8936002)(68736007)(92566002)(2906002)(50986999)(76176999)(101416001)(9686002)(7736002)(105586002)(106116001)(33656002)(5660300001)(7846002)(575784001)(86362001)(106356001)(305945005)(40753002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0802MB2609;H:AM5PR0802MB2610.eurprd08.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Sep 2016 15:43:14.2609 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2609 X-MC-Unique: wj3BBXJtNpuY4HuFoLqAcg-1 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2016-09/txt/msg02145.txt.bz2 Jason Merrill wrote: > I think this broke g++.dg/ext/builtin10.C. That's odd. It appears if you add a fold in gimple-fold.c, it no longer cal= ls the folding code in builtins.c. No idea what the idea behind that is (especiall= y since there are other builtins that appear in both files), but this simple patch = fixes it: If strchr can't be folded in gimple-fold.c, break so folding code in builti= ns.c is also called. OK for commit? 2016-09-28 Wilco Dijkstra * gimple-fold.c (gimple_fold_builtin): After failing to fold strchr, also try the generic folding. -- diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index ddf4cf0ae68ef6708377fdb1a2b45575d90da799..b6802e81fd1a7fd0b309cb9aa0f= 984f7bacb6596 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -2948,7 +2948,10 @@ gimple_fold_builtin (gimple_stmt_iterator *gsi) case BUILT_IN_STRNCAT: return gimple_fold_builtin_strncat (gsi); case BUILT_IN_STRCHR: - return gimple_fold_builtin_strchr (gsi); + if (gimple_fold_builtin_strchr (gsi)) + return true; + /* Perform additional folding in builtin.c. */ + break; case BUILT_IN_FPUTS: return gimple_fold_builtin_fputs (gsi, gimple_call_arg (stmt, 0), gimple_call_arg (stmt, 1), false);