From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71991 invoked by alias); 10 Aug 2016 10:28: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 71970 invoked by uid 89); 10 Aug 2016 10:28:33 -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,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=anonymous, Attached X-HELO: mail-wm0-f43.google.com Received: from mail-wm0-f43.google.com (HELO mail-wm0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 10 Aug 2016 10:28:32 +0000 Received: by mail-wm0-f43.google.com with SMTP id i5so93783201wmg.0 for ; Wed, 10 Aug 2016 03:28:31 -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=nTh2WEiE0v4h0Enb0/O0t5xuwVGdLB+puO/h4jTe6uI=; b=ijiVyfXLxWOj4TUQpwG4m2RfCOgn8VP8jFL/FEwsxAIsosvb3DfZcWhzpDUYsO79Ly zO516EGD3tl2mPX7Hc2JAWlEFn3LCiWLqjdgLyIHKPifMwJyG7+ZdcU4YsK/q9AmpE9E q9+OT4DRzNv0XwYLxOeqgO80RlxXkHrFEsNzZpz0bjBIJUk2gpDiaLL0nwJusCPMW+jG xz8q4wj3+J5TmIpaSz4lAAmaNV4gyj9Swcp/+M9FS8FPe6urz1DH/W813uzRKPXp8th6 VFiJha2PF1EuC6eoOh/8c049EwlyxnhFwDul17K/QQMPyUjfgaTPuQS7HpsXIVTBHYYf jYIg== X-Gm-Message-State: AEkoouuDgQYgup9jRZ4k5eCvzYiwCW02t8Z4MyJq+eW6ftCCoNoedFjuOPoFwLQuhyd6unSSwMFTGpyQeT0n2Q== X-Received: by 10.194.77.142 with SMTP id s14mr3113939wjw.77.1470824909466; Wed, 10 Aug 2016 03:28:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.137.202 with HTTP; Wed, 10 Aug 2016 03:28:28 -0700 (PDT) In-Reply-To: <20160810085703.GH14857@tucnak.redhat.com> References: <0a1eaaf8-3ede-cd56-ffb5-40b25f94e46e@linaro.org> <98613cff-7c48-1a56-0014-6d87c35a8f26@linaro.org> <20160809214617.GB14857@tucnak.redhat.com> <7210cceb-be3b-44b1-13b7-4152e89d2a4f@linaro.org> <20160809215527.GC14857@tucnak.redhat.com> <0c53b0f3-4af6-387c-9350-95b1ae85850d@linaro.org> <20160810085703.GH14857@tucnak.redhat.com> From: Richard Biener Date: Wed, 10 Aug 2016 10:28:00 -0000 Message-ID: Subject: Re: [PR72835] Incorrect arithmetic optimization involving bitfield arguments To: Jakub Jelinek Cc: kugan , "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-08/txt/msg00796.txt.bz2 On Wed, Aug 10, 2016 at 10:57 AM, Jakub Jelinek wrote: > On Wed, Aug 10, 2016 at 08:51:32AM +1000, kugan wrote: >> I see it now. The problem is we are just looking at (-1) being in the ops >> list for passing changed to rewrite_expr_tree in the case of multiplication >> by negate. If we have combined (-1), as in the testcase, we will not have >> the (-1) and will pass changed=false to rewrite_expr_tree. >> >> We should set changed based on what happens in try_special_add_to_ops. >> Attached patch does this. Bootstrap and regression testing are ongoing. Is >> this OK for trunk if there is no regression. > > I think the bug is elsewhere. In particular in > undistribute_ops_list/zero_one_operation/decrement_power. > All those look problematic in this regard, they change RHS of statements > to something that holds a different value, while keeping the LHS. > So, generally you should instead just add a new stmt next to the old one, > and adjust data structures (replace the old SSA_NAME in some ->op with > the new one). decrement_power might be a problem here, dunno if all the > builtins are const in all cases that DSE would kill the old one, > Richard, any preferences for that? reset flow sensitive info + reset debug > stmt uses, or something different? Though, replacing the LHS with a new > anonymous SSA_NAME might be needed too, in case it is before SSA_NAME of a > user var that doesn't yet have any debug stmts. I'd say replacing the LHS is the way to go, with calling the appropriate helper on the old stmt to generate a debug stmt for it / its uses (would need to look it up here). Richard. > > Jakub