From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18436 invoked by alias); 14 Nov 2019 09:41:29 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 18426 invoked by uid 89); 14 Nov 2019 09:41:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Nov 2019 09:41:28 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id CB39AB155; Thu, 14 Nov 2019 09:41:26 +0000 (UTC) Subject: Re: [PATCH] Add if-chain to switch conversion pass. To: Bernhard Reutner-Fischer Cc: Richard Biener , Jakub Jelinek , GCC Patches , Jan Hubicka References: <2c3db526-cac6-4eeb-4afb-12024f8d5af2@suse.cz> <20191104144851.GJ4650@tucnak> <20191106220256.4e7c63a6@nbbrfq.loc> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: Date: Thu, 14 Nov 2019 09:44:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: <20191106220256.4e7c63a6@nbbrfq.loc> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-11/txt/msg01134.txt.bz2 On 11/6/19 10:02 PM, Bernhard Reutner-Fischer wrote: > Also why do you punt on duplicate conditions like in > >> +++ b/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-4.c >> +int main(int argc, char **argv) >> +{ >> + if (argc == 1) >> + else if (argc == 2) >> + else if (argc == 3) >> + else if (argc == 4) >> + else if (argc == 1) >> + { > This block is dead, isn't it. Why don't you just discard it but punt? > Hello. After I moved the pass later in optimization pipeline, such dead conditions are already gone. What's remaining are situations like: if (argc >= 1 && argc <= 10) ... else if (argc >= 8 && argc <= 15) which are overlapping intervals. I'm not planning to handle these in the first iteration of the patch. Martin