From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70217 invoked by alias); 15 Dec 2017 12:41:08 -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 70202 invoked by uid 89); 15 Dec 2017 12:41:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.2 spammy=considerably X-HELO: EUR02-HE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr10067.outbound.protection.outlook.com (HELO EUR02-HE1-obe.outbound.protection.outlook.com) (40.107.1.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Dec 2017 12:41:06 +0000 Received: from DB6PR0801MB2053.eurprd08.prod.outlook.com (10.168.86.22) by DB6PR0801MB2056.eurprd08.prod.outlook.com (10.168.86.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Fri, 15 Dec 2017 12:41:02 +0000 Received: from DB6PR0801MB2053.eurprd08.prod.outlook.com ([fe80::6d85:acfb:77ee:f8ea]) by DB6PR0801MB2053.eurprd08.prod.outlook.com ([fe80::6d85:acfb:77ee:f8ea%17]) with mapi id 15.20.0302.014; Fri, 15 Dec 2017 12:41:02 +0000 From: Wilco Dijkstra To: Qing Zhao CC: GCC Patches , nd , Jeff Law , Richard Biener Subject: Re: [PATCH][Middle-end]2nd patch of PR78809 and PR83026 Date: Fri, 15 Dec 2017 12:41:00 -0000 Message-ID: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB6PR0801MB2056;6:L6xDrtA5ONoIfltsPA6yrDg4QH9xnpafrUBdvrCQjmzJHlNtaJsNRpdu7DPTUV3XxkuXWuTf/UllX0rK/VW20XsTKL9WIvQ8m/SZanG6EcyRH/KfUy/Ga1/zgA5srw71Hyk52IK08U28VdWP5uOwYbxrskcq5GwuyQw3N7PkzuJDp0Xp8FC8pwjtWgxVbPBwz1ArU06Vidfnp65+RPdQBD6qFhi2/pxHwcFVCP4Y0mT6z40gxfry9UdK1DkPdmiy38vij8GCOlfOk+5vkza4XshNXSnSO0esucT492Im6PErpu7VS5o5wcxGPXat9I0ed4Dv4PrUxWqg6xWa+oku42QSGMrrvroFjzFzG0TpwJ8=;5:XAlkEHcLm148ZHtynVkdcEhjSrAFPu/QzoLqryMnq3lVh3RsE3c6B5M7DgL6mXLuVa8st3fBTIMEf2jIpO6wg0CAC5eWLRLlJJSx5/Bm2OX9xT9sv2GNSc5yC5tSHxsAN5v3HrkY8e1MTzzoaWzneGPrpJCxu9KfTpT7GDQZsag=;24:bIcoIKkW6wG63y2RuU6jCIWgSCVy1oBSpYkWsQ14lxQaSO4IQM4Kk75SsbPgAw5ial7hDaPtIY6Xb+sgLWqEPFYKXUPguUoM/sWxfJmvjPg=;7:7px7A50Tl5i17iCaTs9tLjxT46YsKlJHNoigK78iIWsNLLfiPubMzFOBM4MzLDFv3Sqna/uQRvih7IZDh3WtWnXiDjRzmu7FhfzJyeS4w1mkpyT1r/gTilLHT4i0OjDIaBAQUF7+BgMW7EKYPCEdfqPiqkkBa9gq43cIGW+2bi+v+QMOXSL/AygQA3to6Q+G6UpV3inM2cEMrj8cSwqf8hcge8m7jJAYo/qV+74ES7E4OwZM+fxxXGo2p0CqIhcs x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 6a4f964b-e17c-42dc-2bbe-08d543b91a22 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603307);SRVR:DB6PR0801MB2056; x-ms-traffictypediagnostic: DB6PR0801MB2056: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231023)(6055026)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(20161123560025)(20161123555025)(6072148)(201708071742011);SRVR:DB6PR0801MB2056;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:DB6PR0801MB2056; x-forefront-prvs: 05220145DE x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(39860400002)(376002)(346002)(366004)(189003)(199004)(229853002)(305945005)(8936002)(25786009)(4326008)(39060400002)(6246003)(97736004)(7736002)(2906002)(5660300001)(8676002)(81156014)(81166006)(86362001)(66066001)(3660700001)(6916009)(6436002)(53936002)(3280700002)(9686003)(7696005)(55016002)(99286004)(105586002)(106356001)(478600001)(3846002)(6116002)(102836003)(68736007)(54906003)(316002)(74316002)(5250100002)(2900100001)(33656002)(6506007)(72206003)(14454004);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0801MB2056;H:DB6PR0801MB2053.eurprd08.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a4f964b-e17c-42dc-2bbe-08d543b91a22 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2017 12:41:02.8313 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2056 X-SW-Source: 2017-12/txt/msg01038.txt.bz2 Hi Qing, Just looking at a very high level, I have a few comments: 1. Constant folding str(n)cmp - folding is done separately in fold-const-ca= ll.c and gimple-fold.c. There is already code for folding strcmp and strncmp, so we shouldn't need to add new foldings. Or do you have an example that isn't folded as expected? If so, a fix should be added to the existing c= ode. 2. Why check for str(n)cmp =3D=3D 0 / !=3D 0? There is no need to explicitl= y check for equality comparisons since folding into memcmp is always good. 3. Why handle strncmp? There is already code to convert strncmp into strcmp, so why repeat that again in a different way? It just seems to make the code significantly more complex for no benefit. You can achieve the same effect by just optimizing strcmp into memcmp when legal without checking for equality comparison. As a result you can consid= erably reduce the size of this patch while handling more useful cases. Wilco