From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by sourceware.org (Postfix) with ESMTPS id C856F3858C3A for ; Mon, 4 Oct 2021 07:25:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C856F3858C3A Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:105:465:1:4:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4HNC0v2Dr3zQjcN; Mon, 4 Oct 2021 09:25:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Date: Mon, 4 Oct 2021 09:25:14 +0200 (CEST) From: ibuclaw@gdcproject.org To: Jeff Law , Jeff Law via Gcc-patches , =?UTF-8?Q?Lu=C3=ADs_Ferreira?= Message-ID: <248182573.176926.1633332314228@office.mailbox.org> In-Reply-To: <43f9005e-bc54-842b-b7c2-d3e899d8714f@gmail.com> References: <20210930010804.750229-1-contact@lsferreira.net> <43f9005e-bc54-842b-b7c2-d3e899d8714f@gmail.com> Subject: Re: [PATCH] libiberty: d-demangle: use switch instead of if-else MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Normal X-Rspamd-Queue-Id: E7468353 X-Spam-Status: No, score=-7.8 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 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: Mon, 04 Oct 2021 07:25:23 -0000 > On 03/10/2021 23:55 Jeff Law via Gcc-patches wr= ote: >=20 > =20 > On 9/29/2021 7:08 PM, Lu=C3=ADs Ferreira wrote: > > This patch allows the compiler to efficiently generate jump tables inst= ead of > > using if-else-if. > > > > Signed-off-by: Lu=C3=ADs Ferreira > I'm not sure this is terribly useful.=C2=A0 Compilers have the ability to= =20 > analyze the underlying code and make sensible decisions for how to=20 > implement either form.=C2=A0=C2=A0 So the right metric here is does this = make the=20 > code cleaner/easier to understand.=C2=A0 With just 3 clauses it's hard (f= or=20 > me) to make the case that it is considerably cleaner. >=20 I'd be inclined to agree here. FAOD, I put together a quick example of what difference this patch makes. = Other than freely reordering the conditions, the answer is nothing. https://godbolt.org/z/nKjjv64zM Iain.