From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id D797B385BF81; Fri, 17 Apr 2020 01:21:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D797B385BF81 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=segher@kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 03H1LfDB020705; Thu, 16 Apr 2020 20:21:41 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 03H1Le8Q020704; Thu, 16 Apr 2020 20:21:40 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 16 Apr 2020 20:21:40 -0500 From: Segher Boessenkool To: luoxhu--- via Gcc-patches , luoxhu@linux.ibm.com, wschmidt@linux.ibm.com, linkw@gcc.gnu.org, joseph@codesourcery.com, richard.sandiford@arm.com Subject: Re: [PATCH] Fold (add -1; zero_ext; add +1) operations to zero_ext when not zero (PR37451, PR61837) Message-ID: <20200417012140.GJ26902@gate.crashing.org> References: <20200415084755.72653-1-luoxhu@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-17.8 required=5.0 tests=BAYES_00, GIT_PATCH_2, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR 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: Fri, 17 Apr 2020 01:21:48 -0000 On Wed, Apr 15, 2020 at 10:18:16AM +0100, Richard Sandiford wrote: > luoxhu--- via Gcc-patches writes: > > - count = simplify_gen_binary (PLUS, mode, count, const1_rtx); > > + { > > + /* Fold (add -1; zero_ext; add +1) operations to zero_ext based on addop0 > > + is never zero, as gimple pass loop ch will do optimization to simplify > > + the loop to NO loop for loop condition is false. */ > > IMO the code needs to prove this, rather than just assume that previous > passes have made it so. Well, it should gcc_assert it, probably. It is the left-hand side of a+b... it cannot be 0, because niter always is simplified! Segher