From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by sourceware.org (Postfix) with ESMTPS id D33D93858D3C for ; Sun, 3 Oct 2021 21:55:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D33D93858D3C Received: by mail-qv1-xf34.google.com with SMTP id dk4so8954030qvb.2 for ; Sun, 03 Oct 2021 14:55:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=cHPr7PtaM8i4aVsrHQw11YaMkfkI52kIefCnzRwqtQs=; b=gpXTdMxyWcVFF0km1MgNTEp4KhEoRhCc+n3JjF9D6PkJBwe+MTLJ0KAStLn2vDvzay nr3JldMkODAlgqDdk0xFGxEwO/71ogj87Fea2t1dhnA7og5d9PevcnELbocm6TzjYKZc To5ZxXtr4EdiNKLA5M3S7Na7fD48gN0rP1OhYXkoKBOjukhVu4uwyjG6J6hNo6STTPy6 j3a6L0+oiXmNDqtcQEPLBKmjkv5wlTk8Z0GZdlTRf30gaXnYuMQDetLu8kIUDrHOLK2N mTZOojtpLkvLr2cTiORP8JqNqmmFz0PGrWX7RBmy9eyCYdoSCt9DrscbyKSdK3vGVyhK O8aQ== X-Gm-Message-State: AOAM532LUxhCvZgpvmSFdXxa+nFHGcmIq7gA1MBLItrcpUBn5+GWBytJ E+Sz4iEQY03SZ8yDL4LxJJ4/rZWfZ0s= X-Google-Smtp-Source: ABdhPJxAKjXT+11n5I1V9Y6FRaB4ljO29Eoz1JN5ECK5IkwV/lWVk1Y/atDnN3vOfj/X0/S+97XVAQ== X-Received: by 2002:a0c:8045:: with SMTP id 63mr19115853qva.63.1633298143243; Sun, 03 Oct 2021 14:55:43 -0700 (PDT) Received: from [172.31.0.175] (c-98-202-48-222.hsd1.ut.comcast.net. [98.202.48.222]) by smtp.gmail.com with ESMTPSA id a16sm6587063qkn.16.2021.10.03.14.55.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 03 Oct 2021 14:55:42 -0700 (PDT) Subject: Re: [PATCH] libiberty: d-demangle: use switch instead of if-else To: =?UTF-8?Q?Lu=c3=ads_Ferreira?= , gcc-patches@gcc.gnu.org References: <20210930010804.750229-1-contact@lsferreira.net> From: Jeff Law Message-ID: <43f9005e-bc54-842b-b7c2-d3e899d8714f@gmail.com> Date: Sun, 3 Oct 2021 15:55:41 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210930010804.750229-1-contact@lsferreira.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=-2.5 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.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: Sun, 03 Oct 2021 21:55:46 -0000 On 9/29/2021 7:08 PM, Luís Ferreira wrote: > This patch allows the compiler to efficiently generate jump tables instead of > using if-else-if. > > Signed-off-by: Luís Ferreira I'm not sure this is terribly useful.  Compilers have the ability to analyze the underlying code and make sensible decisions for how to implement either form.   So the right metric here is does this make the code cleaner/easier to understand.  With just 3 clauses it's hard (for me) to make the case that it is considerably cleaner. Jeff