From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61228 invoked by alias); 18 Dec 2019 02:57:34 -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 61219 invoked by uid 89); 18 Dec 2019 02:57:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=crazylht@gmail.com, H*f:sk:omWKLkC, H*i:sk:feXcRNi, H*i:sk:omWKLkC X-HELO: mail-oi1-f195.google.com Received: from mail-oi1-f195.google.com (HELO mail-oi1-f195.google.com) (209.85.167.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Dec 2019 02:57:33 +0000 Received: by mail-oi1-f195.google.com with SMTP id k4so359915oik.2 for ; Tue, 17 Dec 2019 18:57:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hq4zVH87NFvcB7KGzDPt1pV1YQvkqf8sbfbDMCkux9g=; b=bbWwEQdXz9aQ/cb1Duql0um/itGVVIFPZOvwJEaNsLHwuvGKYuodXASTRqbvjYjJ/q rL4jx0waBTz0zSPNNyoD36uzRz88ut1AFVdKU5OBV6DmKKeCW08D2xfRXut+Bd1o6BPO NT+nt7vpD4eQhaLtlVLRsNucfMD5/rHJjaYOOgc0EmIsO+OaP3HVroT21myUCM8yqNfT 4+599XE/o7aRLJKhxMU0izWi4uX9otestPOMhAbtOB5KsRkUrqMF5HGQvGESjm1onXbV EiyziNYyG0QJBSCN+pLeBMzxu6ElPLON6UZJ2uGZjjDJnQ8w8zBYYRw7kcw7k4+Fk+j0 hSbg== MIME-Version: 1.0 References: In-Reply-To: From: Hongtao Liu Date: Wed, 18 Dec 2019 03:44:00 -0000 Message-ID: Subject: Re: [PATCH] Fix redundant load missed by fre [tree-optimization 92980] To: Andrew Pinski Cc: Richard Biener , GCC Patches , "H. J. Lu" , wwwhhhyyy333@gmail.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg01246.txt.bz2 On Wed, Dec 18, 2019 at 10:50 AM Andrew Pinski wrote: > > On Tue, Dec 17, 2019 at 6:33 PM Hongtao Liu wrote: > > > > Hi: > > This patch is to simplify A * C + (-D) -> (A - D/C) * C when C is a > > power of 2 and D mod C == 0. > > bootstrap and make check is ok. > > I don't see why D has to be negative here. > > > >TREE_CODE (TREE_TYPE (@0)) == INTEGER_TYPE > + && TYPE_UNSIGNED (TREE_TYPE (@0)) > > This is the wrong check here. > Use INTEGRAL_TYPE_P . > > >+ (plus (mult @0 integer_pow2p@1) INTEGER_CST@2) > > You might want a :s here for the mult and/or plus. > > unsigned HOST_WIDE_INT d = tree_to_uhwi (@2); > ... > Maybe use wide_int math instead of HOST_WIDE_INT here, then you don't > need the tree_fits_uhwi_p check. > > Add a testcase should tests the pattern directly rather than indirectly. > > Also we are in stage 3 which means bug fixes only so this might/should > wait until stage 1. Yes, thanks. > > Thanks, > Andrew Pinski > > > > > changelog > > gcc/ > > * gcc/match.pd (A * C + (-D) = (A - D/C) * C. when C is a > > power of 2 and D mod C == 0): Add new simplification. > > > > gcc/testsuite > > * gcc.dg/pr92980.c: New test. > > > > -- > > BR, > > Hongtao -- BR, Hongtao