From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31749 invoked by alias); 9 Aug 2016 21:50:47 -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 31740 invoked by uid 89); 9 Aug 2016 21:50:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=sweep, Attached, 2016-08-10, 20160810 X-HELO: mail-wm0-f47.google.com Received: from mail-wm0-f47.google.com (HELO mail-wm0-f47.google.com) (74.125.82.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 09 Aug 2016 21:50:37 +0000 Received: by mail-wm0-f47.google.com with SMTP id i5so63660458wmg.0 for ; Tue, 09 Aug 2016 14:50:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KSqQ+Kcj9XxfO66brjOdMJRRBaRcRERAtwB4jp7ZHJQ=; b=ctfMeMXyX0SpSbI3JhLRdc3Ql5Me5Xz4u2A+Gwts3vqdMX6ryHdlIwezTNR9BwQD7g guDxcak/5UUQxuvTa88i5iO2hOj3jaacTgoHqLNPy4/wQrfd0lMbN4+vO1sVlzQ8seIQ kTbLM4i8uNtB2xEQmzo8fJtfVsprKvxGvvuk3nqzjG67TuwsnZKKpShINFvyfnULTcYb SDEYxfFIxrA04q7n2NZsd+U8hmXlTRZ2D1I4IFBR9rzmGERwVdnm9Y6+fgpg4EEOAdCt PSIiey9J79R2nQixdhrC8XHLEFPWCedfG7E1IOMWeA+zBJtw/lQ1S09EzLAsNsYV0bCB 33CQ== X-Gm-Message-State: AEkooutNQ9sCTRfMLEQTNeviGdSm7AcnyMaiN82ZGjLTLmeOpYozvIBuedKud3RRVlwAf1ZCwshIjfSBM4edcQ== X-Received: by 10.46.71.144 with SMTP id u138mr89385lja.20.1470779434140; Tue, 09 Aug 2016 14:50:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.42.4 with HTTP; Tue, 9 Aug 2016 14:50:33 -0700 (PDT) In-Reply-To: <98613cff-7c48-1a56-0014-6d87c35a8f26@linaro.org> References: <0a1eaaf8-3ede-cd56-ffb5-40b25f94e46e@linaro.org> <98613cff-7c48-1a56-0014-6d87c35a8f26@linaro.org> From: Andrew Pinski Date: Tue, 09 Aug 2016 21:50:00 -0000 Message-ID: Subject: Re: [PR72835] Incorrect arithmetic optimization involving bitfield arguments To: kugan Cc: "gcc-patches@gcc.gnu.org" , Richard Biener Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-08/txt/msg00762.txt.bz2 On Tue, Aug 9, 2016 at 2:42 PM, kugan wrote: > > > On 09/08/16 23:43, kugan wrote: >> >> Hi, >> >> The test-case in PR72835 is failing with -O2 and passing with >> -fno-tree-reassoc. It also passes with -O2 -fno-tree-vrp. >> >> diff of .115t.dse2 and .116t.reassoc1 for the c++ testcase is as >> follows, which looks OK. >> >> + unsigned int _16; >> + unsigned int _17; >> + unsigned int _18; >> >> : >> _1 = s1.m2; >> _2 = (unsigned int) _1; >> _3 = s1.m3; >> _4 = (unsigned int) _3; >> - _5 = -_4; >> - _6 = _2 * _5; >> + _5 = _4; >> + _6 = _5 * _2; >> var_32.0_7 = var_32; >> _8 = (unsigned int) var_32.0_7; >> _9 = s1.m1; >> _10 = (unsigned int) _9; >> - _11 = -_10; >> - _12 = _8 * _11; >> - c_14 = _6 + _12; >> + _11 = _10; >> + _12 = _11 * _8; >> + _16 = _12 + _6; >> + _18 = _16; >> + _17 = -_18; >> + c_14 = _17; >> if (c_14 != 4098873984) >> >> >> However, I noticed that when we re-associate and assign different >> operands to the stmts, we are not resetting the flow information to the >> LHS. This looks wrong. Attached patch resets it. With this, the >> testcases in TH PR is now working. >> >> >> Bootstrap and regression testing for x86_64-linux-gnu is in progress. Is >> this OK for trunk if there is no regression. > > > There was no new regression while testing. I also moved the testcase from > gcc.dg/torture/pr72835.c to gcc.dg/tree-ssa/pr72835.c. Is this OK for trunk? Why did you move the test-case from gcc.dg/torture to gcc.dg/tree-ssa? I think most executable testcases (that was using standard options) should be in tortue testcases to do a full sweep of the options. Thanks, Andrew > > Thanks, > Kugan > > gcc/testsuite/ChangeLog: > > 2016-08-10 Kugan Vivekanandarajah > > PR tree-optimization/72835 > * gcc.dg/tree-ssa/pr72835.c: New test. > > gcc/ChangeLog: > > 2016-08-10 Kugan Vivekanandarajah > > > PR tree-optimization/72835 > * tree-ssa-reassoc.c (rewrite_expr_tree): Reset value_range of LHS > when > operands are changed. > (rewrite_expr_tree_parallel): Likewise.