From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id 98A4A39730E3; Wed, 3 Mar 2021 18:34:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 98A4A39730E3 Received: by mail-il1-x130.google.com with SMTP id c10so22332917ilo.8; Wed, 03 Mar 2021 10:34:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=fk6PzTGBxe0ljyxl3DGrx8P2Y2mcaFB1qMWh9QqbG+k=; b=WkrnjT/MCla465zEAbLYqMTUT9LlUElQysJRmrt/Q+/fZFr5+RMvkySfpUOJc1aYAr zXqPlWbco3czDcMR/S9iqHS1uB3TMwZHvxA5UvOoA8KxyJtRz7RN22zt5Whkc+X0ZoZa WW8x5X7TYzDVc7YiqU4AJrD4g7Ykk4D42HPqWo1jftshcbeInUmsNcbj5SlotxtnBTXz ERx5IOZF+FeeLmIrI5RFhQT2RnZE2ntOdUlfUR3s8XX1dJ/AOMgsTjj0uuUVFVj4TqwE kFN2IB5cFR+AJ93qDhiU0j7zuBBhJ/BJ/qZ0/TjciKYq+bsuYAZZI789PBsTyVHSTnyk KbaQ== X-Gm-Message-State: AOAM533CB1q8vHheS5my3mfqpkX7vjPGgx81zTVY3HRogiXYeEEvy5i5 aLbgpaRE6bCtostncjgHiYFCoc1Gx1k9oA== X-Google-Smtp-Source: ABdhPJzASHYx4kD9ahWqInNGZ5BoRkhhHaGOyZ1b66Zcq4eaeGP5QSq4IremH6XhUrcI9ANUXuH4BQ== X-Received: by 2002:a05:6e02:10d1:: with SMTP id s17mr551878ilj.159.1614796484572; Wed, 03 Mar 2021 10:34:44 -0800 (PST) Received: from localhost.localdomain (65-130-77-186.slkc.qwest.net. [65.130.77.186]) by smtp.gmail.com with ESMTPSA id w6sm12604988ilm.38.2021.03.03.10.34.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Mar 2021 10:34:44 -0800 (PST) Subject: Re: [PATCH] fwprop: Fix single_use_p calculation To: Ilya Leoshkevich , Richard Sandiford Cc: Andreas Krebbel , gcc-patches@gcc.gnu.org References: <20210302223726.135359-1-iii@linux.ibm.com> From: Jeff Law Message-ID: <15cbc584-bd5e-6042-1ed4-67a76cb73830@gmail.com> Date: Wed, 3 Mar 2021 11:34:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210302223726.135359-1-iii@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2021 18:34:49 -0000 On 3/2/21 3:37 PM, Ilya Leoshkevich via Gcc-patches wrote: > Bootstrapped and regtested on x86_64-redhat-linux, ppc64le-redhat-linux > and s390x-redhat-linux. Ok for master? > > > > Commit efb6bc55a93a ("fwprop: Allow (subreg (mem)) simplifications") > introduced a check that was supposed to look at the propagated def's > number of uses. It uses insn_info::num_uses (), which in reality > returns the number of uses def's insn has. The whole change therefore > works only by accident. > > Fix by looking at def_info's uses instead of insn_info's uses. This > requires passing around def_info instead of insn_info. > > gcc/ChangeLog: > > 2021-03-02 Ilya Leoshkevich > > * fwprop.c (def_has_single_use_p): New function. > (fwprop_propagation::fwprop_propagation): Look at > def_info's uses. > (try_fwprop_subst_note): Use def_info instead of insn_info. > (try_fwprop_subst_pattern): Likewise. > (try_fwprop_subst_notes): Likewise. > (try_fwprop_subst): Likewise. > (forward_propagate_subreg): Likewise. > (forward_propagate_and_simplify): Likewise. > (forward_propagate_into): Likewise. > * iterator-utils.h (single_element_p): New function. Given we're well into stage4, I'd recommend deferring to gcc-12 unless this fixes a code correctness issue. Jeff