From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 1F7253858C2C for ; Thu, 3 Feb 2022 11:03:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1F7253858C2C Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id CD0FE21122; Thu, 3 Feb 2022 11:03:15 +0000 (UTC) Received: from murzim.suse.de (murzim.suse.de [10.160.4.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 99539A3B91; Thu, 3 Feb 2022 11:03:15 +0000 (UTC) Date: Thu, 3 Feb 2022 12:03:15 +0100 (CET) From: Richard Biener To: Jakub Jelinek cc: Eric Botcazou , gcc-patches@gcc.gnu.org, Zhao Wei Liew Subject: Re: [PATCH] match.pd: Fix up 1 / X for unsigned X optimization [PR104280] In-Reply-To: <20220203095526.GK2646553@tucnak> Message-ID: <6r4nor91-9n33-82ro-q939-1p7542q4240@fhfr.qr> References: <2228044.ElGaqSPkdT@fomalhaut> <612pq5qr-38s3-2767-9os8-q334254n8p5r@fhfr.qr> <11915893.O9o76ZdvQC@fomalhaut> <20220203093334.GJ2646553@tucnak> <20220203095526.GK2646553@tucnak> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 03 Feb 2022 11:03:22 -0000 On Thu, 3 Feb 2022, Jakub Jelinek wrote: > On Thu, Feb 03, 2022 at 10:40:10AM +0100, Richard Biener wrote: > > Yes, we definitely have multiple of those cases. I do think > > preserving "an idiom", for example literal 0/0 or all x/0 might be > > worth considering. But I also think we have to sort out different > > language standards requirements vs. the middle-end and whos > > responsible for making sure we adhere here. > > I think we try to preserve literal 0/0 and x/0, including this > optimization which punts if the divisor is literal. But, for literal > 0/0 and x/0 we alsy emit -Wdiv-by-zero warning, maybe that was the > reason why libgcc2.c did it differently. Sure, I bet the code is quite old since we very likely propagate the equality and optimize the division away since a long time. Now that #pragma GCC diagnostic is a thing we can probably write literal 0/0 if we choose to preserve that until the end. But as said, for the libgcc2.c case I'd simply remove all of it. Richard.