[{"id":1760113,"web_url":"http://patchwork.ozlabs.org/comment/1760113/","msgid":"<CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com>","list_archive_url":null,"date":"2017-08-30T12:28:01","subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","submitter":{"id":1765,"url":"http://patchwork.ozlabs.org/api/people/1765/","name":"Richard Biener","email":"richard.guenther@gmail.com"},"content":"On Wed, Aug 30, 2017 at 1:13 PM, Martin Liška <mliska@suse.cz> wrote:\n> Hi.\n>\n> Simple transformation of switch statements where degenerated switch can be interpreted\n> as gimple condition (or removed if having any non-default case). I originally though\n> that we don't have switch statements without non-default cases, but PR82032 shows we\n> can see it.\n>\n> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n>\n> Ready to be installed?\n\nWhile I guess this case is ok to handle here it would be nice if CFG cleanup\nwould do the same.  I suppose find_taken_edge somehow doesn't work for\nthis case even after my last enhancement?  Or is CFG cleanup for some reason\nnot run?\n\nRichard.\n\n> Martin\n>\n> gcc/ChangeLog:\n>\n> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>\n>         PR tree-optimization/82032\n>         * tree-switch-conversion.c (generate_high_low_equality): New\n>         function.\n>         (expand_degenerated_switch): Likewise.\n>         (process_switch): Call expand_degenerated_switch.\n>         (try_switch_expansion): Likewise.\n>         (emit_case_nodes): Use generate_high_low_equality.\n>\n> gcc/testsuite/ChangeLog:\n>\n> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>\n>         PR tree-optimization/82032\n>         * gcc.dg/tree-ssa/pr68198.c: Update jump threading expectations.\n>         * gcc.dg/tree-ssa/switch-expansion.c: New test.\n>         * gcc.dg/tree-ssa/vrp34.c: Update scanned pattern.\n>         * g++.dg/other/pr82032.C: New test.\n> ---\n>  gcc/testsuite/g++.dg/other/pr82032.C             |  36 +++++++\n>  gcc/testsuite/gcc.dg/tree-ssa/pr68198.c          |   6 +-\n>  gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c |  14 +++\n>  gcc/testsuite/gcc.dg/tree-ssa/vrp34.c            |   5 +-\n>  gcc/tree-switch-conversion.c                     | 123 ++++++++++++++++++-----\n>  5 files changed, 152 insertions(+), 32 deletions(-)\n>  create mode 100644 gcc/testsuite/g++.dg/other/pr82032.C\n>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c\n>\n>","headers":{"Return-Path":"<gcc-patches-return-461155-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461155-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"jhWDuZYw\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xj4Xv3ktyz9sN5\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 22:28:12 +1000 (AEST)","(qmail 81032 invoked by alias); 30 Aug 2017 12:28:06 -0000","(qmail 80282 invoked by uid 89); 30 Aug 2017 12:28:05 -0000","from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com)\n\t(74.125.82.65) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 30 Aug 2017 12:28:04 +0000","by mail-wm0-f65.google.com with SMTP id e204so1623038wma.2 for\n\t<gcc-patches@gcc.gnu.org>; Wed, 30 Aug 2017 05:28:03 -0700 (PDT)","by 10.80.180.249 with HTTP; Wed, 30 Aug 2017 05:28:01 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=Iykqz/V7kna8BW3CPpcuAm9GFQqqXB/EJzLDsaCG+4jj5Zv3d1xq9\n\tT0N1OGvX1MUPFMTeF2draQN+Zxtu4lAhiDyfbFzw3qOLXiBDMPQ9t1RwWtQ4y6mH\n\tC5aBzfl26YzC2YeaveW6pacBlZvUf/hZvjyRNSYhX09zHvIoDpOipc=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; s=\n\tdefault; bh=Pv+bJSmnvuRY/5OkOhzyCxzQKh8=; b=jhWDuZYwfg2D6gxRf0yB\n\t0MVAK7W3DcpdHXPfTI31pQzbYphVLT7qUKmThhGsS4d41cNGclYpZbJjP/iyRbzP\n\t/xTeA/ahH6blL9T+MRon29KDrx+ShSlzy0lBvHTeFL7kPSIRFxeXjd1UfQ87sSgc\n\txOalez4SjGmmJ8E4aYNWUj4=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-10.5 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1921","X-HELO":"mail-wm0-f65.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=6Ou/llzBvdli9P2hYtzqDkiS8+hdcHG8WbIscOrTWRI=;\n\tb=lChF4+nA43LDZtE3qwEwa0MNHFnInHxEcUM2xAK66Cfuc+GikaDmFm3835GX0EGpNw\n\thH9i4/O2Yg9uHw/Bw0Hv2pTuPq60sIAsA+IoeOuKowHTQP1GqxuJFwak51EvyJ3J5A/Q\n\tO3YFlTGLc4PgJuAiR/L6AH/8ZgNYrjuOAy2/j+Gl512N7Iybn7lKMGRoTP+k8UFV+rCs\n\t6s5CUKJj/S4F0CpeXTnfKJu65OT1h2uPR0tBhscr8PmCiIFe3yTvgbtHGjti5ZXUUujE\n\t6W9GlHicGJepH5j8lPOQNdqUkqfA7uhU1ZFCjUhMWnLXDkGa8e02DZFsnElrQFJy/bbl\n\tVOrg==","X-Gm-Message-State":"AHYfb5gw7XE426sJ4Z/5y6CizjLkWs2k5Ggex8p9t1FwLHCvinTe+eQL\tB8wDpbqEzrdWTEZnPBUBsPLk8H9fYZ4g","X-Received":"by 10.80.186.139 with SMTP id x11mr1628044ede.260.1504096081879;\n\tWed, 30 Aug 2017 05:28:01 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<bde90963-7695-89d5-6792-e8f803f71160@suse.cz>","References":"<bde90963-7695-89d5-6792-e8f803f71160@suse.cz>","From":"Richard Biener <richard.guenther@gmail.com>","Date":"Wed, 30 Aug 2017 14:28:01 +0200","Message-ID":"<CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com>","Subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","To":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-IsSubscribed":"yes"}},{"id":1760119,"web_url":"http://patchwork.ozlabs.org/comment/1760119/","msgid":"<b9003663-ce11-8f29-6ebb-624077b53157@suse.cz>","list_archive_url":null,"date":"2017-08-30T12:32:43","subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","submitter":{"id":62010,"url":"http://patchwork.ozlabs.org/api/people/62010/","name":"Martin Liška","email":"mliska@suse.cz"},"content":"On 08/30/2017 02:28 PM, Richard Biener wrote:\n> On Wed, Aug 30, 2017 at 1:13 PM, Martin Liška <mliska@suse.cz> wrote:\n>> Hi.\n>>\n>> Simple transformation of switch statements where degenerated switch can be interpreted\n>> as gimple condition (or removed if having any non-default case). I originally though\n>> that we don't have switch statements without non-default cases, but PR82032 shows we\n>> can see it.\n>>\n>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n>>\n>> Ready to be installed?\n> \n> While I guess this case is ok to handle here it would be nice if CFG cleanup\n> would do the same.  I suppose find_taken_edge somehow doesn't work for\n> this case even after my last enhancement?  Or is CFG cleanup for some reason\n> not run?\n\nDo you mean both with # of non-default edges equal to 0 and 1?\nLet me take a look.\n\nMartin\n\n> \n> Richard.\n> \n>> Martin\n>>\n>> gcc/ChangeLog:\n>>\n>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>\n>>         PR tree-optimization/82032\n>>         * tree-switch-conversion.c (generate_high_low_equality): New\n>>         function.\n>>         (expand_degenerated_switch): Likewise.\n>>         (process_switch): Call expand_degenerated_switch.\n>>         (try_switch_expansion): Likewise.\n>>         (emit_case_nodes): Use generate_high_low_equality.\n>>\n>> gcc/testsuite/ChangeLog:\n>>\n>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>\n>>         PR tree-optimization/82032\n>>         * gcc.dg/tree-ssa/pr68198.c: Update jump threading expectations.\n>>         * gcc.dg/tree-ssa/switch-expansion.c: New test.\n>>         * gcc.dg/tree-ssa/vrp34.c: Update scanned pattern.\n>>         * g++.dg/other/pr82032.C: New test.\n>> ---\n>>  gcc/testsuite/g++.dg/other/pr82032.C             |  36 +++++++\n>>  gcc/testsuite/gcc.dg/tree-ssa/pr68198.c          |   6 +-\n>>  gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c |  14 +++\n>>  gcc/testsuite/gcc.dg/tree-ssa/vrp34.c            |   5 +-\n>>  gcc/tree-switch-conversion.c                     | 123 ++++++++++++++++++-----\n>>  5 files changed, 152 insertions(+), 32 deletions(-)\n>>  create mode 100644 gcc/testsuite/g++.dg/other/pr82032.C\n>>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c\n>>\n>>","headers":{"Return-Path":"<gcc-patches-return-461158-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461158-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"YrU4QDMV\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xj4fK3Q04z9s7F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 22:32:57 +1000 (AEST)","(qmail 124163 invoked by alias); 30 Aug 2017 12:32:48 -0000","(qmail 124129 invoked by uid 89); 30 Aug 2017 12:32:47 -0000","from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 30 Aug 2017 12:32:46 +0000","from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx1.suse.de (Postfix) with ESMTP id F0DD2AD8C;\n\tWed, 30 Aug 2017 12:32:43 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=fRMQM2nV6r4pNMFg1+OA02E1rRTgdz5fhSGa6a9oBav4zuJ77nCms\n\tT6rPeFau71EC+VwEYGsTMfMcsDPzDa7fTng1PFU5CgGvaeUBmWg/X+g5seTim4SJ\n\ti9yBuWHHQofyDjgU+3iS303SoU665KStXNBb9SRgSK724FvQGs/YLE=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; s=default;\n\tbh=nhW8jDwiXY72rb46pj+kOisoLsE=; b=YrU4QDMVYYoHlXUXtJy6IypWsM9Y\n\tHeNJ96unfpB6hguP2Ul6c4FO9pN2MwF8bOdl3yz7uMJpnEizyKlFoZlGGf6x04Cf\n\tFvz/JVakbAK+4bTxXtTkxyrRj6bJ70hmCZz+WNQE+rwtTHxXs+ssgqqZPi+zafQt\n\t7EYuKMdb4QzcdY0=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mx1.suse.de","Subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","To":"Richard Biener <richard.guenther@gmail.com>","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","References":"<bde90963-7695-89d5-6792-e8f803f71160@suse.cz>\n\t<CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com>","From":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Message-ID":"<b9003663-ce11-8f29-6ebb-624077b53157@suse.cz>","Date":"Wed, 30 Aug 2017 14:32:43 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com>","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"8bit","X-IsSubscribed":"yes"}},{"id":1760130,"web_url":"http://patchwork.ozlabs.org/comment/1760130/","msgid":"<CAFiYyc3VE78iX+sgXoz_DKYP-LWdxBrE=D5WjBRN-e45xZdyGw@mail.gmail.com>","list_archive_url":null,"date":"2017-08-30T12:56:16","subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","submitter":{"id":1765,"url":"http://patchwork.ozlabs.org/api/people/1765/","name":"Richard Biener","email":"richard.guenther@gmail.com"},"content":"On Wed, Aug 30, 2017 at 2:32 PM, Martin Liška <mliska@suse.cz> wrote:\n> On 08/30/2017 02:28 PM, Richard Biener wrote:\n>> On Wed, Aug 30, 2017 at 1:13 PM, Martin Liška <mliska@suse.cz> wrote:\n>>> Hi.\n>>>\n>>> Simple transformation of switch statements where degenerated switch can be interpreted\n>>> as gimple condition (or removed if having any non-default case). I originally though\n>>> that we don't have switch statements without non-default cases, but PR82032 shows we\n>>> can see it.\n>>>\n>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n>>>\n>>> Ready to be installed?\n>>\n>> While I guess this case is ok to handle here it would be nice if CFG cleanup\n>> would do the same.  I suppose find_taken_edge somehow doesn't work for\n>> this case even after my last enhancement?  Or is CFG cleanup for some reason\n>> not run?\n>\n> Do you mean both with # of non-default edges equal to 0 and 1?\n> Let me take a look.\n\nFirst and foremost 0.  The case of 1 non-default and a default would\nneed extra code.\n\nRichard.\n\n> Martin\n>\n>>\n>> Richard.\n>>\n>>> Martin\n>>>\n>>> gcc/ChangeLog:\n>>>\n>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>\n>>>         PR tree-optimization/82032\n>>>         * tree-switch-conversion.c (generate_high_low_equality): New\n>>>         function.\n>>>         (expand_degenerated_switch): Likewise.\n>>>         (process_switch): Call expand_degenerated_switch.\n>>>         (try_switch_expansion): Likewise.\n>>>         (emit_case_nodes): Use generate_high_low_equality.\n>>>\n>>> gcc/testsuite/ChangeLog:\n>>>\n>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>\n>>>         PR tree-optimization/82032\n>>>         * gcc.dg/tree-ssa/pr68198.c: Update jump threading expectations.\n>>>         * gcc.dg/tree-ssa/switch-expansion.c: New test.\n>>>         * gcc.dg/tree-ssa/vrp34.c: Update scanned pattern.\n>>>         * g++.dg/other/pr82032.C: New test.\n>>> ---\n>>>  gcc/testsuite/g++.dg/other/pr82032.C             |  36 +++++++\n>>>  gcc/testsuite/gcc.dg/tree-ssa/pr68198.c          |   6 +-\n>>>  gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c |  14 +++\n>>>  gcc/testsuite/gcc.dg/tree-ssa/vrp34.c            |   5 +-\n>>>  gcc/tree-switch-conversion.c                     | 123 ++++++++++++++++++-----\n>>>  5 files changed, 152 insertions(+), 32 deletions(-)\n>>>  create mode 100644 gcc/testsuite/g++.dg/other/pr82032.C\n>>>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c\n>>>\n>>>\n>","headers":{"Return-Path":"<gcc-patches-return-461160-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461160-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"ZN5V/7Ax\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xj59Z12Dyz9sRW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 22:56:29 +1000 (AEST)","(qmail 25717 invoked by alias); 30 Aug 2017 12:56:21 -0000","(qmail 25706 invoked by uid 89); 30 Aug 2017 12:56:20 -0000","from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com)\n\t(74.125.82.66) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 30 Aug 2017 12:56:18 +0000","by mail-wm0-f66.google.com with SMTP id x189so1695050wmg.4 for\n\t<gcc-patches@gcc.gnu.org>; Wed, 30 Aug 2017 05:56:18 -0700 (PDT)","by 10.80.180.249 with HTTP; Wed, 30 Aug 2017 05:56:16 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=FYGt2unKZ/RbsWr6xTO6KgObm7QeWZyesGXUG0GImLBfs/uMS+GLo\n\tkcaukwORFNnYzO0D63c0Z5b8+ID5D6jhZE+ETYU0y07Apfr1pXgjtSWKqPvzLOqa\n\tbIvQwvbQtV0J0ApDTf1MhIFyr/3w3khSBF7auhlv5Aw8RsWVHw1ErU=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; s=\n\tdefault; bh=9ekaj5GI4zh1B0SXWd0mkSyKQfY=; b=ZN5V/7AxjiPatx3qFqnC\n\t0rApthJOgEutXdpim/JONVt7CQk6qBAMwGaolWb/FYpNwbkfeFf4hPlvaSYqkthk\n\tuBRFquLLIkj4EX2jIYxqF9T1W26cc5Fb3LArZ30ywcg+vVgPDRAV5N311lnMFGLK\n\tElh7f7aTu3KqznBwOO1WHQA=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-10.5 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mail-wm0-f66.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=TbPShuA5kmOjB8sB2+rChxGgwf6vgWoi4WPiVpIBKKI=;\n\tb=i6dTYm6YzDt428Y9zT8R0hcFQudgyN5NTzpobhiDWHHu3GxpIHOAlzQzxiAhZtdpS0\n\tobWCUTmXQUVB2pTIUFDKQhriJnnxYER70XbAE7cyaJrpJ6hEwVn8VmojOHCUws2k4tYq\n\t8uQV22sGnz6Wuv0aqHngnIlSxbtnNzQW8U94LPDRvkX+85tA5zdw/qx4DyPAaMNeYPW7\n\tYwIY42bRtRrygbYvdceLWhjXmVRv7NcPW8vgB71cawVtcCO+uUG+2r7WsXnz8df2V47p\n\tkF6hAyyCMK6iqEVq7M7uzceMKVXIkWSj3cg0+Cs0rf8FO6LSSLZVbVI3PxSLRf5m93HH\n\trLDg==","X-Gm-Message-State":"AHYfb5iAefMhXryTPmFRLtr7VvXl9UcXTNXUX2uH0wLaghGbnHEwXMVv\tX2SJramqZFhErL7qVCy61UOXHVnZc4hP","X-Received":"by 10.80.164.30 with SMTP id u30mr1516060edb.246.1504097776480;\n\tWed, 30 Aug 2017 05:56:16 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<b9003663-ce11-8f29-6ebb-624077b53157@suse.cz>","References":"<bde90963-7695-89d5-6792-e8f803f71160@suse.cz>\n\t<CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com>\n\t<b9003663-ce11-8f29-6ebb-624077b53157@suse.cz>","From":"Richard Biener <richard.guenther@gmail.com>","Date":"Wed, 30 Aug 2017 14:56:16 +0200","Message-ID":"<CAFiYyc3VE78iX+sgXoz_DKYP-LWdxBrE=D5WjBRN-e45xZdyGw@mail.gmail.com>","Subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","To":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-IsSubscribed":"yes"}},{"id":1761507,"web_url":"http://patchwork.ozlabs.org/comment/1761507/","msgid":"<60ea6209-3b23-6398-da99-19326e24d8c2@suse.cz>","list_archive_url":null,"date":"2017-09-01T08:07:21","subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","submitter":{"id":62010,"url":"http://patchwork.ozlabs.org/api/people/62010/","name":"Martin Liška","email":"mliska@suse.cz"},"content":"On 08/30/2017 02:56 PM, Richard Biener wrote:\n> On Wed, Aug 30, 2017 at 2:32 PM, Martin Liška <mliska@suse.cz> wrote:\n>> On 08/30/2017 02:28 PM, Richard Biener wrote:\n>>> On Wed, Aug 30, 2017 at 1:13 PM, Martin Liška <mliska@suse.cz> wrote:\n>>>> Hi.\n>>>>\n>>>> Simple transformation of switch statements where degenerated switch can be interpreted\n>>>> as gimple condition (or removed if having any non-default case). I originally though\n>>>> that we don't have switch statements without non-default cases, but PR82032 shows we\n>>>> can see it.\n>>>>\n>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n>>>>\n>>>> Ready to be installed?\n>>>\n>>> While I guess this case is ok to handle here it would be nice if CFG cleanup\n>>> would do the same.  I suppose find_taken_edge somehow doesn't work for\n>>> this case even after my last enhancement?  Or is CFG cleanup for some reason\n>>> not run?\n>>\n>> Do you mean both with # of non-default edges equal to 0 and 1?\n>> Let me take a look.\n> \n> First and foremost 0.  The case of 1 non-default and a default would\n> need extra code.\n\nFor the test-case I reduced, one needs:\n\ndiff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c\nindex b7593068ea9..13af516c6ac 100644\n--- a/gcc/tree-cfg.c\n+++ b/gcc/tree-cfg.c\n@@ -8712,7 +8712,7 @@ const pass_data pass_data_split_crit_edges =\n   PROP_no_crit_edges, /* properties_provided */\n   0, /* properties_destroyed */\n   0, /* todo_flags_start */\n-  0, /* todo_flags_finish */\n+  TODO_cleanup_cfg, /* todo_flags_finish */\n };\n \n class pass_split_crit_edges : public gimple_opt_pass\n\nAnd the code eliminates the problematic switch statement. Do you believe it's the right approach\nto add the clean up and preserve the assert in tree-switch-conversion.c?\n\nFor the case with # of edges == 1, should I place it to tree-cfg.c in order to trigger it as a clean-up?\nThoughts?\n\nMartin\n\n> \n> Richard.\n> \n>> Martin\n>>\n>>>\n>>> Richard.\n>>>\n>>>> Martin\n>>>>\n>>>> gcc/ChangeLog:\n>>>>\n>>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>>\n>>>>         PR tree-optimization/82032\n>>>>         * tree-switch-conversion.c (generate_high_low_equality): New\n>>>>         function.\n>>>>         (expand_degenerated_switch): Likewise.\n>>>>         (process_switch): Call expand_degenerated_switch.\n>>>>         (try_switch_expansion): Likewise.\n>>>>         (emit_case_nodes): Use generate_high_low_equality.\n>>>>\n>>>> gcc/testsuite/ChangeLog:\n>>>>\n>>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>>\n>>>>         PR tree-optimization/82032\n>>>>         * gcc.dg/tree-ssa/pr68198.c: Update jump threading expectations.\n>>>>         * gcc.dg/tree-ssa/switch-expansion.c: New test.\n>>>>         * gcc.dg/tree-ssa/vrp34.c: Update scanned pattern.\n>>>>         * g++.dg/other/pr82032.C: New test.\n>>>> ---\n>>>>  gcc/testsuite/g++.dg/other/pr82032.C             |  36 +++++++\n>>>>  gcc/testsuite/gcc.dg/tree-ssa/pr68198.c          |   6 +-\n>>>>  gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c |  14 +++\n>>>>  gcc/testsuite/gcc.dg/tree-ssa/vrp34.c            |   5 +-\n>>>>  gcc/tree-switch-conversion.c                     | 123 ++++++++++++++++++-----\n>>>>  5 files changed, 152 insertions(+), 32 deletions(-)\n>>>>  create mode 100644 gcc/testsuite/g++.dg/other/pr82032.C\n>>>>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c\n>>>>\n>>>>\n>>","headers":{"Return-Path":"<gcc-patches-return-461253-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461253-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"E3HHwxdK\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkBgR1Dpgz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 18:07:45 +1000 (AEST)","(qmail 59092 invoked by alias); 1 Sep 2017 08:07:37 -0000","(qmail 58673 invoked by uid 89); 1 Sep 2017 08:07:29 -0000","from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 01 Sep 2017 08:07:24 +0000","from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx1.suse.de (Postfix) with ESMTP id 53F52AB9B;\n\tFri,  1 Sep 2017 08:07:22 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=m665pemKxey96jGyrDl+OguiHzRBQ0dzB0oWprKhK4ZE/AMpqLpE4\n\tdKBOtrJqaaP655tLo1S3zAFpM+mDbt7bgnnNKrCRjfdt3LLF947bcjgNWY059Xwi\n\tRoIFGQ+fnGcErm7tHMSVGmQyi3r0RR6r0S7q1xPQhy83PXzv82k+fg=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; s=default;\n\tbh=JtXetr+NTwrjwUuwhoPYlzIFam8=; b=E3HHwxdKE5Eky9wfm/rJLDUit0j2\n\tioFj/L+fPCPyXU/N2i/uIs2cau9sEoTPZHkR1jqgZdbZJGE/lMCjJ9kAApM4h/lv\n\t/wVefCuFBjC+b914yRpDFMDAtHNvph2b1a7slCygsmbyg8C6sdKjmmkALz/2FUFZ\n\tIm/9qk5kD04Jw9Y=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=H*M:da99","X-HELO":"mx1.suse.de","Subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","To":"Richard Biener <richard.guenther@gmail.com>","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","References":"<bde90963-7695-89d5-6792-e8f803f71160@suse.cz>\n\t<CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com>\n\t<b9003663-ce11-8f29-6ebb-624077b53157@suse.cz>\n\t<CAFiYyc3VE78iX+sgXoz_DKYP-LWdxBrE=D5WjBRN-e45xZdyGw@mail.gmail.com>","From":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Message-ID":"<60ea6209-3b23-6398-da99-19326e24d8c2@suse.cz>","Date":"Fri, 1 Sep 2017 10:07:21 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<CAFiYyc3VE78iX+sgXoz_DKYP-LWdxBrE=D5WjBRN-e45xZdyGw@mail.gmail.com>","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"8bit","X-IsSubscribed":"yes"}},{"id":1761514,"web_url":"http://patchwork.ozlabs.org/comment/1761514/","msgid":"<CAFiYyc3pwpXW_2xEYO_fjbT=HHETJsrbq8kW_jbLHZFxZFmGbg@mail.gmail.com>","list_archive_url":null,"date":"2017-09-01T08:26:30","subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","submitter":{"id":1765,"url":"http://patchwork.ozlabs.org/api/people/1765/","name":"Richard Biener","email":"richard.guenther@gmail.com"},"content":"On Fri, Sep 1, 2017 at 10:07 AM, Martin Liška <mliska@suse.cz> wrote:\n> On 08/30/2017 02:56 PM, Richard Biener wrote:\n>> On Wed, Aug 30, 2017 at 2:32 PM, Martin Liška <mliska@suse.cz> wrote:\n>>> On 08/30/2017 02:28 PM, Richard Biener wrote:\n>>>> On Wed, Aug 30, 2017 at 1:13 PM, Martin Liška <mliska@suse.cz> wrote:\n>>>>> Hi.\n>>>>>\n>>>>> Simple transformation of switch statements where degenerated switch can be interpreted\n>>>>> as gimple condition (or removed if having any non-default case). I originally though\n>>>>> that we don't have switch statements without non-default cases, but PR82032 shows we\n>>>>> can see it.\n>>>>>\n>>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n>>>>>\n>>>>> Ready to be installed?\n>>>>\n>>>> While I guess this case is ok to handle here it would be nice if CFG cleanup\n>>>> would do the same.  I suppose find_taken_edge somehow doesn't work for\n>>>> this case even after my last enhancement?  Or is CFG cleanup for some reason\n>>>> not run?\n>>>\n>>> Do you mean both with # of non-default edges equal to 0 and 1?\n>>> Let me take a look.\n>>\n>> First and foremost 0.  The case of 1 non-default and a default would\n>> need extra code.\n>\n> For the test-case I reduced, one needs:\n>\n> diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c\n> index b7593068ea9..13af516c6ac 100644\n> --- a/gcc/tree-cfg.c\n> +++ b/gcc/tree-cfg.c\n> @@ -8712,7 +8712,7 @@ const pass_data pass_data_split_crit_edges =\n>    PROP_no_crit_edges, /* properties_provided */\n>    0, /* properties_destroyed */\n>    0, /* todo_flags_start */\n> -  0, /* todo_flags_finish */\n> +  TODO_cleanup_cfg, /* todo_flags_finish */\n>  };\n>\n>  class pass_split_crit_edges : public gimple_opt_pass\n>\n> And the code eliminates the problematic switch statement. Do you believe it's the right approach\n> to add the clean up and preserve the assert in tree-switch-conversion.c?\n\nEh, no.  If you run cleanup-cfg after critical edge splitting they\nwill be unsplit immediately, making\nit (mostly) a no-op.\n\nOTOH I wanted to eliminate that \"pass\" in favor of just calling\nsplit_critical_edges () where needed\n(that's already done in some places).\n\n> For the case with # of edges == 1, should I place it to tree-cfg.c in order to trigger it as a clean-up?\n\nI believe the code for edges == 1 can reside in\ncleanup_control_expr_graph.  Probably easiest\nfrom a flow perspective if we do the switch -> cond transform before\nthe existing code handling\ncond and switch via find-taken-edge.\n\n> Thoughts?\n>\n> Martin\n>\n>>\n>> Richard.\n>>\n>>> Martin\n>>>\n>>>>\n>>>> Richard.\n>>>>\n>>>>> Martin\n>>>>>\n>>>>> gcc/ChangeLog:\n>>>>>\n>>>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>>>\n>>>>>         PR tree-optimization/82032\n>>>>>         * tree-switch-conversion.c (generate_high_low_equality): New\n>>>>>         function.\n>>>>>         (expand_degenerated_switch): Likewise.\n>>>>>         (process_switch): Call expand_degenerated_switch.\n>>>>>         (try_switch_expansion): Likewise.\n>>>>>         (emit_case_nodes): Use generate_high_low_equality.\n>>>>>\n>>>>> gcc/testsuite/ChangeLog:\n>>>>>\n>>>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>>>\n>>>>>         PR tree-optimization/82032\n>>>>>         * gcc.dg/tree-ssa/pr68198.c: Update jump threading expectations.\n>>>>>         * gcc.dg/tree-ssa/switch-expansion.c: New test.\n>>>>>         * gcc.dg/tree-ssa/vrp34.c: Update scanned pattern.\n>>>>>         * g++.dg/other/pr82032.C: New test.\n>>>>> ---\n>>>>>  gcc/testsuite/g++.dg/other/pr82032.C             |  36 +++++++\n>>>>>  gcc/testsuite/gcc.dg/tree-ssa/pr68198.c          |   6 +-\n>>>>>  gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c |  14 +++\n>>>>>  gcc/testsuite/gcc.dg/tree-ssa/vrp34.c            |   5 +-\n>>>>>  gcc/tree-switch-conversion.c                     | 123 ++++++++++++++++++-----\n>>>>>  5 files changed, 152 insertions(+), 32 deletions(-)\n>>>>>  create mode 100644 gcc/testsuite/g++.dg/other/pr82032.C\n>>>>>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c\n>>>>>\n>>>>>\n>>>\n>","headers":{"Return-Path":"<gcc-patches-return-461254-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461254-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"klbxv7Wb\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkC5V1dPRz9t1t\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 18:26:53 +1000 (AEST)","(qmail 21471 invoked by alias); 1 Sep 2017 08:26:39 -0000","(qmail 19683 invoked by uid 89); 1 Sep 2017 08:26:38 -0000","from mail-wm0-f42.google.com (HELO mail-wm0-f42.google.com)\n\t(74.125.82.42) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 01 Sep 2017 08:26:33 +0000","by mail-wm0-f42.google.com with SMTP id v2so3962472wmf.0 for\n\t<gcc-patches@gcc.gnu.org>; Fri, 01 Sep 2017 01:26:32 -0700 (PDT)","by 10.80.180.249 with HTTP; Fri, 1 Sep 2017 01:26:30 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=PHYuntCErxSpHlg0hOThWrNmKCpCG6IxvcpZZ5/wAe/++vHi8JkEt\n\tlM6l8Y91csa2maDCXb8BvB94JwgP16LfsfYVTPX14R8C1QPO5+/eMN3967wA17G1\n\tQ76rqRNiLnoFjCiHRPyGydVaUzVsbTOtcgDV6H7dUu/AjEVOYMHlyI=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; s=\n\tdefault; bh=JDa3oE3oFFtMEy/3c792ilpps4U=; b=klbxv7WbSZjR6/mmGX9G\n\t3Giw00aNjW4pdQBcUwzK85W1LZlF1GWm9v8pXudVUBtyUpiQ3OhxISrC7ki5rRFS\n\tAiR06p86/G5u4ePhzBmZzejO2MZitZegHCbAvgPKHaO4IR6iWY0f/6MXBCsu236Z\n\tOjHqUEyICbqSDTmJ+JwhzUM=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-24.0 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2,\n\tGIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mail-wm0-f42.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=e/EVj9zxVGacO6dkxEeCNez6XSiv3wXJymm1eXlbfxA=;\n\tb=PXr3M+OLzPd+xBR9T8tKmiQE18j/k5X1UOSrNfLqoF5JAwYPgIPE/EbzXjr/6MVpsb\n\t+l+WzL8N6MJNgytHfA/aOmqGCSJYF/pmmICpuWxHpQ29UiG+vWyHzbsW2mmGhp6Wf6en\n\tvHt8r/HVTVoVgqR1NQEA0jX1FAzcaQ3G/Fl4SBMuW3TrHkmSy+WejlGsAc+B4Um0XDEy\n\tW7K6nuYXsk/B77dmx08zgvpZb4ZOH+MOethbz/FWgytA8dYvL6sWqxCcLZ9TxAEZEGh5\n\tkwoefBHC79b6fBp+dOuRX5UTfmXx5gZdVbHYug1MHtCTja5RU+8AZ4jVisgveCafkbFL\n\twTWA==","X-Gm-Message-State":"AHPjjUj3dfAYvFa+0cF4Ji7YeGfvtujtZC1T0JTwMwDPn6LadQ2PK5YD\tqE3BgJp3U1YOqdJCvN4yN/stJdQwbg==","X-Google-Smtp-Source":"ADKCNb7m7Ey1EGm6yZFG8zm3ZFyrSf3DWYFVwSzGkHPRGlaelLXcAyAPWQ8OIAecGTBQdLIDsbnlassu/O8w+K1XN3Q=","X-Received":"by 10.80.149.89 with SMTP id v25mr1065398eda.292.1504254391058;\n\tFri, 01 Sep 2017 01:26:31 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<60ea6209-3b23-6398-da99-19326e24d8c2@suse.cz>","References":"<bde90963-7695-89d5-6792-e8f803f71160@suse.cz>\n\t<CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com>\n\t<b9003663-ce11-8f29-6ebb-624077b53157@suse.cz>\n\t<CAFiYyc3VE78iX+sgXoz_DKYP-LWdxBrE=D5WjBRN-e45xZdyGw@mail.gmail.com>\n\t<60ea6209-3b23-6398-da99-19326e24d8c2@suse.cz>","From":"Richard Biener <richard.guenther@gmail.com>","Date":"Fri, 1 Sep 2017 10:26:30 +0200","Message-ID":"<CAFiYyc3pwpXW_2xEYO_fjbT=HHETJsrbq8kW_jbLHZFxZFmGbg@mail.gmail.com>","Subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","To":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-IsSubscribed":"yes"}},{"id":1761582,"web_url":"http://patchwork.ozlabs.org/comment/1761582/","msgid":"<ad30c64e-29c6-ccbd-bc94-ffb5926f2b39@suse.cz>","list_archive_url":null,"date":"2017-09-01T10:44:08","subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","submitter":{"id":62010,"url":"http://patchwork.ozlabs.org/api/people/62010/","name":"Martin Liška","email":"mliska@suse.cz"},"content":"On 09/01/2017 10:26 AM, Richard Biener wrote:\n> On Fri, Sep 1, 2017 at 10:07 AM, Martin Liška <mliska@suse.cz> wrote:\n>> On 08/30/2017 02:56 PM, Richard Biener wrote:\n>>> On Wed, Aug 30, 2017 at 2:32 PM, Martin Liška <mliska@suse.cz> wrote:\n>>>> On 08/30/2017 02:28 PM, Richard Biener wrote:\n>>>>> On Wed, Aug 30, 2017 at 1:13 PM, Martin Liška <mliska@suse.cz> wrote:\n>>>>>> Hi.\n>>>>>>\n>>>>>> Simple transformation of switch statements where degenerated switch can be interpreted\n>>>>>> as gimple condition (or removed if having any non-default case). I originally though\n>>>>>> that we don't have switch statements without non-default cases, but PR82032 shows we\n>>>>>> can see it.\n>>>>>>\n>>>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n>>>>>>\n>>>>>> Ready to be installed?\n>>>>>\n>>>>> While I guess this case is ok to handle here it would be nice if CFG cleanup\n>>>>> would do the same.  I suppose find_taken_edge somehow doesn't work for\n>>>>> this case even after my last enhancement?  Or is CFG cleanup for some reason\n>>>>> not run?\n>>>>\n>>>> Do you mean both with # of non-default edges equal to 0 and 1?\n>>>> Let me take a look.\n>>>\n>>> First and foremost 0.  The case of 1 non-default and a default would\n>>> need extra code.\n>>\n>> For the test-case I reduced, one needs:\n>>\n>> diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c\n>> index b7593068ea9..13af516c6ac 100644\n>> --- a/gcc/tree-cfg.c\n>> +++ b/gcc/tree-cfg.c\n>> @@ -8712,7 +8712,7 @@ const pass_data pass_data_split_crit_edges =\n>>    PROP_no_crit_edges, /* properties_provided */\n>>    0, /* properties_destroyed */\n>>    0, /* todo_flags_start */\n>> -  0, /* todo_flags_finish */\n>> +  TODO_cleanup_cfg, /* todo_flags_finish */\n>>  };\n>>\n>>  class pass_split_crit_edges : public gimple_opt_pass\n>>\n>> And the code eliminates the problematic switch statement. Do you believe it's the right approach\n>> to add the clean up and preserve the assert in tree-switch-conversion.c?\n> \n> Eh, no.  If you run cleanup-cfg after critical edge splitting they\n> will be unsplit immediately, making\n> it (mostly) a no-op.\n> \n> OTOH I wanted to eliminate that \"pass\" in favor of just calling\n> split_critical_edges () where needed\n> (that's already done in some places).\n\nGood, so I will leave it to you. Should I in meantime remove the assert in tree-switch-conversion.c ?\n\n> \n>> For the case with # of edges == 1, should I place it to tree-cfg.c in order to trigger it as a clean-up?\n> \n> I believe the code for edges == 1 can reside in\n> cleanup_control_expr_graph.  Probably easiest\n> from a flow perspective if we do the switch -> cond transform before\n> the existing code handling\n> cond and switch via find-taken-edge.\n\nWorking on that, good place to do the transformation.\n\nMartin\n\n> \n>> Thoughts?\n>>\n>> Martin\n>>\n>>>\n>>> Richard.\n>>>\n>>>> Martin\n>>>>\n>>>>>\n>>>>> Richard.\n>>>>>\n>>>>>> Martin\n>>>>>>\n>>>>>> gcc/ChangeLog:\n>>>>>>\n>>>>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>>>>\n>>>>>>         PR tree-optimization/82032\n>>>>>>         * tree-switch-conversion.c (generate_high_low_equality): New\n>>>>>>         function.\n>>>>>>         (expand_degenerated_switch): Likewise.\n>>>>>>         (process_switch): Call expand_degenerated_switch.\n>>>>>>         (try_switch_expansion): Likewise.\n>>>>>>         (emit_case_nodes): Use generate_high_low_equality.\n>>>>>>\n>>>>>> gcc/testsuite/ChangeLog:\n>>>>>>\n>>>>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>>>>\n>>>>>>         PR tree-optimization/82032\n>>>>>>         * gcc.dg/tree-ssa/pr68198.c: Update jump threading expectations.\n>>>>>>         * gcc.dg/tree-ssa/switch-expansion.c: New test.\n>>>>>>         * gcc.dg/tree-ssa/vrp34.c: Update scanned pattern.\n>>>>>>         * g++.dg/other/pr82032.C: New test.\n>>>>>> ---\n>>>>>>  gcc/testsuite/g++.dg/other/pr82032.C             |  36 +++++++\n>>>>>>  gcc/testsuite/gcc.dg/tree-ssa/pr68198.c          |   6 +-\n>>>>>>  gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c |  14 +++\n>>>>>>  gcc/testsuite/gcc.dg/tree-ssa/vrp34.c            |   5 +-\n>>>>>>  gcc/tree-switch-conversion.c                     | 123 ++++++++++++++++++-----\n>>>>>>  5 files changed, 152 insertions(+), 32 deletions(-)\n>>>>>>  create mode 100644 gcc/testsuite/g++.dg/other/pr82032.C\n>>>>>>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c\n>>>>>>\n>>>>>>\n>>>>\n>>","headers":{"Return-Path":"<gcc-patches-return-461259-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461259-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"ijBnQpzo\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkG88711Sz9sMN\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 20:44:22 +1000 (AEST)","(qmail 24813 invoked by alias); 1 Sep 2017 10:44:13 -0000","(qmail 24800 invoked by uid 89); 1 Sep 2017 10:44:13 -0000","from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 01 Sep 2017 10:44:11 +0000","from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx1.suse.de (Postfix) with ESMTP id 5446CAB43;\n\tFri,  1 Sep 2017 10:44:09 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=MQlrQDNL1Zdq4jbNmxNO9baN0AjBKADD8RF5kIALvWGmTkABmF3QN\n\tCKDGMqSFu7wAyxMCO3krH5RtpVpNAKfy0HTKR7rXRO5lNOxVbBxE8QtJtOkZ5sCS\n\tO+Ug7fOS9NIynZNdL7FsdQBDvFKfQVZkwcPcXP3ykMVQiIF7Q+v5BM=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type:content-transfer-encoding; s=default;\n\tbh=9uZlk1fn7X4aoNZpOcf2FVWYwh0=; b=ijBnQpzowI6R+HatMSJiZi962lf2\n\tEhMDpE0nmD+l+GHjRYrUREYlUkB/mNQBvNooxN8KYSKnIYSeunVXoznQFY4J3P4A\n\t4uq87tB9N/m+Xneb/D8NNjuGcSWRmqmJnE1XnkmqOoZE17WwSeF2II3jIFkIIDSQ\n\tEvsvXAPzVwpYVuY=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=H*M:bc94","X-HELO":"mx1.suse.de","Subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","To":"Richard Biener <richard.guenther@gmail.com>","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","References":"<bde90963-7695-89d5-6792-e8f803f71160@suse.cz>\n\t<CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com>\n\t<b9003663-ce11-8f29-6ebb-624077b53157@suse.cz>\n\t<CAFiYyc3VE78iX+sgXoz_DKYP-LWdxBrE=D5WjBRN-e45xZdyGw@mail.gmail.com>\n\t<60ea6209-3b23-6398-da99-19326e24d8c2@suse.cz>\n\t<CAFiYyc3pwpXW_2xEYO_fjbT=HHETJsrbq8kW_jbLHZFxZFmGbg@mail.gmail.com>","From":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Message-ID":"<ad30c64e-29c6-ccbd-bc94-ffb5926f2b39@suse.cz>","Date":"Fri, 1 Sep 2017 12:44:08 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<CAFiYyc3pwpXW_2xEYO_fjbT=HHETJsrbq8kW_jbLHZFxZFmGbg@mail.gmail.com>","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"8bit","X-IsSubscribed":"yes"}},{"id":1761588,"web_url":"http://patchwork.ozlabs.org/comment/1761588/","msgid":"<CAFiYyc0bKTdxLsXW=ZDose8peoOV_Qw+518+A8YEwjX+q-tv=g@mail.gmail.com>","list_archive_url":null,"date":"2017-09-01T10:57:30","subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","submitter":{"id":1765,"url":"http://patchwork.ozlabs.org/api/people/1765/","name":"Richard Biener","email":"richard.guenther@gmail.com"},"content":"On Fri, Sep 1, 2017 at 12:44 PM, Martin Liška <mliska@suse.cz> wrote:\n> On 09/01/2017 10:26 AM, Richard Biener wrote:\n>> On Fri, Sep 1, 2017 at 10:07 AM, Martin Liška <mliska@suse.cz> wrote:\n>>> On 08/30/2017 02:56 PM, Richard Biener wrote:\n>>>> On Wed, Aug 30, 2017 at 2:32 PM, Martin Liška <mliska@suse.cz> wrote:\n>>>>> On 08/30/2017 02:28 PM, Richard Biener wrote:\n>>>>>> On Wed, Aug 30, 2017 at 1:13 PM, Martin Liška <mliska@suse.cz> wrote:\n>>>>>>> Hi.\n>>>>>>>\n>>>>>>> Simple transformation of switch statements where degenerated switch can be interpreted\n>>>>>>> as gimple condition (or removed if having any non-default case). I originally though\n>>>>>>> that we don't have switch statements without non-default cases, but PR82032 shows we\n>>>>>>> can see it.\n>>>>>>>\n>>>>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n>>>>>>>\n>>>>>>> Ready to be installed?\n>>>>>>\n>>>>>> While I guess this case is ok to handle here it would be nice if CFG cleanup\n>>>>>> would do the same.  I suppose find_taken_edge somehow doesn't work for\n>>>>>> this case even after my last enhancement?  Or is CFG cleanup for some reason\n>>>>>> not run?\n>>>>>\n>>>>> Do you mean both with # of non-default edges equal to 0 and 1?\n>>>>> Let me take a look.\n>>>>\n>>>> First and foremost 0.  The case of 1 non-default and a default would\n>>>> need extra code.\n>>>\n>>> For the test-case I reduced, one needs:\n>>>\n>>> diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c\n>>> index b7593068ea9..13af516c6ac 100644\n>>> --- a/gcc/tree-cfg.c\n>>> +++ b/gcc/tree-cfg.c\n>>> @@ -8712,7 +8712,7 @@ const pass_data pass_data_split_crit_edges =\n>>>    PROP_no_crit_edges, /* properties_provided */\n>>>    0, /* properties_destroyed */\n>>>    0, /* todo_flags_start */\n>>> -  0, /* todo_flags_finish */\n>>> +  TODO_cleanup_cfg, /* todo_flags_finish */\n>>>  };\n>>>\n>>>  class pass_split_crit_edges : public gimple_opt_pass\n>>>\n>>> And the code eliminates the problematic switch statement. Do you believe it's the right approach\n>>> to add the clean up and preserve the assert in tree-switch-conversion.c?\n>>\n>> Eh, no.  If you run cleanup-cfg after critical edge splitting they\n>> will be unsplit immediately, making\n>> it (mostly) a no-op.\n>>\n>> OTOH I wanted to eliminate that \"pass\" in favor of just calling\n>> split_critical_edges () where needed\n>> (that's already done in some places).\n>\n> Good, so I will leave it to you. Should I in meantime remove the assert in tree-switch-conversion.c ?\n\nYes, as said your patch was generally OK, I just wondered why we left\nthe switches \"unoptimized\".\n\nRichard.\n\n>>\n>>> For the case with # of edges == 1, should I place it to tree-cfg.c in order to trigger it as a clean-up?\n>>\n>> I believe the code for edges == 1 can reside in\n>> cleanup_control_expr_graph.  Probably easiest\n>> from a flow perspective if we do the switch -> cond transform before\n>> the existing code handling\n>> cond and switch via find-taken-edge.\n>\n> Working on that, good place to do the transformation.\n>\n> Martin\n>\n>>\n>>> Thoughts?\n>>>\n>>> Martin\n>>>\n>>>>\n>>>> Richard.\n>>>>\n>>>>> Martin\n>>>>>\n>>>>>>\n>>>>>> Richard.\n>>>>>>\n>>>>>>> Martin\n>>>>>>>\n>>>>>>> gcc/ChangeLog:\n>>>>>>>\n>>>>>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>>>>>\n>>>>>>>         PR tree-optimization/82032\n>>>>>>>         * tree-switch-conversion.c (generate_high_low_equality): New\n>>>>>>>         function.\n>>>>>>>         (expand_degenerated_switch): Likewise.\n>>>>>>>         (process_switch): Call expand_degenerated_switch.\n>>>>>>>         (try_switch_expansion): Likewise.\n>>>>>>>         (emit_case_nodes): Use generate_high_low_equality.\n>>>>>>>\n>>>>>>> gcc/testsuite/ChangeLog:\n>>>>>>>\n>>>>>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>>>>>\n>>>>>>>         PR tree-optimization/82032\n>>>>>>>         * gcc.dg/tree-ssa/pr68198.c: Update jump threading expectations.\n>>>>>>>         * gcc.dg/tree-ssa/switch-expansion.c: New test.\n>>>>>>>         * gcc.dg/tree-ssa/vrp34.c: Update scanned pattern.\n>>>>>>>         * g++.dg/other/pr82032.C: New test.\n>>>>>>> ---\n>>>>>>>  gcc/testsuite/g++.dg/other/pr82032.C             |  36 +++++++\n>>>>>>>  gcc/testsuite/gcc.dg/tree-ssa/pr68198.c          |   6 +-\n>>>>>>>  gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c |  14 +++\n>>>>>>>  gcc/testsuite/gcc.dg/tree-ssa/vrp34.c            |   5 +-\n>>>>>>>  gcc/tree-switch-conversion.c                     | 123 ++++++++++++++++++-----\n>>>>>>>  5 files changed, 152 insertions(+), 32 deletions(-)\n>>>>>>>  create mode 100644 gcc/testsuite/g++.dg/other/pr82032.C\n>>>>>>>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c\n>>>>>>>\n>>>>>>>\n>>>>>\n>>>\n>","headers":{"Return-Path":"<gcc-patches-return-461260-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461260-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"H2RUHjgI\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkGRc0NHCz9rxl\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 20:57:47 +1000 (AEST)","(qmail 93054 invoked by alias); 1 Sep 2017 10:57:39 -0000","(qmail 92818 invoked by uid 89); 1 Sep 2017 10:57:38 -0000","from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com)\n\t(74.125.82.67) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 01 Sep 2017 10:57:33 +0000","by mail-wm0-f67.google.com with SMTP id e204so2129214wma.2 for\n\t<gcc-patches@gcc.gnu.org>; Fri, 01 Sep 2017 03:57:33 -0700 (PDT)","by 10.80.180.249 with HTTP; Fri, 1 Sep 2017 03:57:30 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=EMD+QkZIaCQRptESHTlfWXYfwfvaUDXq4A1e9vfXqn0WiZIJfJgfA\n\tRhvMddv3ezX7XRHcfD6G3f4J4ViC8DrBiRYCse5XsgAr/95HQddRZH6QjfddPSJb\n\twyrQ+EdhQIKVzichfQskeSqdPsUYypx14MgVqvMeGIIhiORDG0OmRo=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; s=\n\tdefault; bh=4YS+8xCmXhdXd82cd91Yp5Pn/k0=; b=H2RUHjgIXeFUW9/fAaXt\n\te7w329v+DPiTEU18nq7gNYUan44ASod8gMxQFu4ltM5s962JKuU5SlyvzpvPL372\n\tdCUC8kBeLRra0S/HoByMSXZUg3I48+oT6YbjNXgqw88Ge/LCWuVnWzR2IAv2E0zG\n\tDFmJc0JPUvQGqoX848+mKrg=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-24.0 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2,\n\tGIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=wondered","X-HELO":"mail-wm0-f67.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=1PlzXLi7jR9kneuZDvumyVckFyfT4bxwq0enM1VHpLw=;\n\tb=jVVQXjVfoCpwYZqGcLVmzNJVInhpThZQFn+hUkdwDfRoFcwekFsAeWF/OOU5kwFhfy\n\t71QwxZi3KQEZC3C1o2JuECjUF4pgjBQq6Q6KwAp30Cf62b9ve4nDD2x/BpQxIhzKMriG\n\tCNet3CoiwSWs8wM5tqkIShcOaHjYUVPyuafvSnNnFbfTHz9QSyiUJggNbm6VYnHe7MoX\n\tQXrGkN44hrNFzML7dY1pVHyLkMu1MRXuS8IXCzaemJOPcjLnqX5wvLQc3kHOrPpAX1ii\n\tbfHvKhuzwCbHnZlP0n8x0TubOXwLuRVgB4RUzow210U/ePJRF11vg8xRMeMDZZdt6as4\n\txzSw==","X-Gm-Message-State":"AHPjjUi/88QTLd3cNzJuLRU8OvVqPNZBqaeuv0vdggOX92b8KjgLyR+Z\tt/YUXx1ARdAmk9iNh0s6QowVRlfwUg==","X-Google-Smtp-Source":"ADKCNb499LKpyFFr0KXNJ3TP52wrY7ipDpLcXsoWSTi9IWJ0kus/sBvufzty8IBx8IRBvPdTxPANDKLS4kV+P24Ul34=","X-Received":"by 10.80.186.139 with SMTP id x11mr1397612ede.260.1504263451324;\n\tFri, 01 Sep 2017 03:57:31 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<ad30c64e-29c6-ccbd-bc94-ffb5926f2b39@suse.cz>","References":"<bde90963-7695-89d5-6792-e8f803f71160@suse.cz>\n\t<CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com>\n\t<b9003663-ce11-8f29-6ebb-624077b53157@suse.cz>\n\t<CAFiYyc3VE78iX+sgXoz_DKYP-LWdxBrE=D5WjBRN-e45xZdyGw@mail.gmail.com>\n\t<60ea6209-3b23-6398-da99-19326e24d8c2@suse.cz>\n\t<CAFiYyc3pwpXW_2xEYO_fjbT=HHETJsrbq8kW_jbLHZFxZFmGbg@mail.gmail.com>\n\t<ad30c64e-29c6-ccbd-bc94-ffb5926f2b39@suse.cz>","From":"Richard Biener <richard.guenther@gmail.com>","Date":"Fri, 1 Sep 2017 12:57:30 +0200","Message-ID":"<CAFiYyc0bKTdxLsXW=ZDose8peoOV_Qw+518+A8YEwjX+q-tv=g@mail.gmail.com>","Subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","To":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-IsSubscribed":"yes"}},{"id":1761667,"web_url":"http://patchwork.ozlabs.org/comment/1761667/","msgid":"<bc2320ae-8896-336f-2d34-f1a0977b5044@suse.cz>","list_archive_url":null,"date":"2017-09-01T13:01:39","subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","submitter":{"id":62010,"url":"http://patchwork.ozlabs.org/api/people/62010/","name":"Martin Liška","email":"mliska@suse.cz"},"content":"On 09/01/2017 12:57 PM, Richard Biener wrote:\n> On Fri, Sep 1, 2017 at 12:44 PM, Martin Liška <mliska@suse.cz> wrote:\n>> On 09/01/2017 10:26 AM, Richard Biener wrote:\n>>> On Fri, Sep 1, 2017 at 10:07 AM, Martin Liška <mliska@suse.cz> wrote:\n>>>> On 08/30/2017 02:56 PM, Richard Biener wrote:\n>>>>> On Wed, Aug 30, 2017 at 2:32 PM, Martin Liška <mliska@suse.cz> wrote:\n>>>>>> On 08/30/2017 02:28 PM, Richard Biener wrote:\n>>>>>>> On Wed, Aug 30, 2017 at 1:13 PM, Martin Liška <mliska@suse.cz> wrote:\n>>>>>>>> Hi.\n>>>>>>>>\n>>>>>>>> Simple transformation of switch statements where degenerated switch can be interpreted\n>>>>>>>> as gimple condition (or removed if having any non-default case). I originally though\n>>>>>>>> that we don't have switch statements without non-default cases, but PR82032 shows we\n>>>>>>>> can see it.\n>>>>>>>>\n>>>>>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n>>>>>>>>\n>>>>>>>> Ready to be installed?\n>>>>>>>\n>>>>>>> While I guess this case is ok to handle here it would be nice if CFG cleanup\n>>>>>>> would do the same.  I suppose find_taken_edge somehow doesn't work for\n>>>>>>> this case even after my last enhancement?  Or is CFG cleanup for some reason\n>>>>>>> not run?\n>>>>>>\n>>>>>> Do you mean both with # of non-default edges equal to 0 and 1?\n>>>>>> Let me take a look.\n>>>>>\n>>>>> First and foremost 0.  The case of 1 non-default and a default would\n>>>>> need extra code.\n>>>>\n>>>> For the test-case I reduced, one needs:\n>>>>\n>>>> diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c\n>>>> index b7593068ea9..13af516c6ac 100644\n>>>> --- a/gcc/tree-cfg.c\n>>>> +++ b/gcc/tree-cfg.c\n>>>> @@ -8712,7 +8712,7 @@ const pass_data pass_data_split_crit_edges =\n>>>>    PROP_no_crit_edges, /* properties_provided */\n>>>>    0, /* properties_destroyed */\n>>>>    0, /* todo_flags_start */\n>>>> -  0, /* todo_flags_finish */\n>>>> +  TODO_cleanup_cfg, /* todo_flags_finish */\n>>>>  };\n>>>>\n>>>>  class pass_split_crit_edges : public gimple_opt_pass\n>>>>\n>>>> And the code eliminates the problematic switch statement. Do you believe it's the right approach\n>>>> to add the clean up and preserve the assert in tree-switch-conversion.c?\n>>>\n>>> Eh, no.  If you run cleanup-cfg after critical edge splitting they\n>>> will be unsplit immediately, making\n>>> it (mostly) a no-op.\n>>>\n>>> OTOH I wanted to eliminate that \"pass\" in favor of just calling\n>>> split_critical_edges () where needed\n>>> (that's already done in some places).\n>>\n>> Good, so I will leave it to you. Should I in meantime remove the assert in tree-switch-conversion.c ?\n> \n> Yes, as said your patch was generally OK, I just wondered why we left\n> the switches \"unoptimized\".\n\nGood.\n\nI'm sending v2 for single non-default case situation.\nPatch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n\nReady to be installed?\nMartin\n\n> \n> Richard.\n> \n>>>\n>>>> For the case with # of edges == 1, should I place it to tree-cfg.c in order to trigger it as a clean-up?\n>>>\n>>> I believe the code for edges == 1 can reside in\n>>> cleanup_control_expr_graph.  Probably easiest\n>>> from a flow perspective if we do the switch -> cond transform before\n>>> the existing code handling\n>>> cond and switch via find-taken-edge.\n>>\n>> Working on that, good place to do the transformation.\n>>\n>> Martin\n>>\n>>>\n>>>> Thoughts?\n>>>>\n>>>> Martin\n>>>>\n>>>>>\n>>>>> Richard.\n>>>>>\n>>>>>> Martin\n>>>>>>\n>>>>>>>\n>>>>>>> Richard.\n>>>>>>>\n>>>>>>>> Martin\n>>>>>>>>\n>>>>>>>> gcc/ChangeLog:\n>>>>>>>>\n>>>>>>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>>>>>>\n>>>>>>>>         PR tree-optimization/82032\n>>>>>>>>         * tree-switch-conversion.c (generate_high_low_equality): New\n>>>>>>>>         function.\n>>>>>>>>         (expand_degenerated_switch): Likewise.\n>>>>>>>>         (process_switch): Call expand_degenerated_switch.\n>>>>>>>>         (try_switch_expansion): Likewise.\n>>>>>>>>         (emit_case_nodes): Use generate_high_low_equality.\n>>>>>>>>\n>>>>>>>> gcc/testsuite/ChangeLog:\n>>>>>>>>\n>>>>>>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>>>>>>\n>>>>>>>>         PR tree-optimization/82032\n>>>>>>>>         * gcc.dg/tree-ssa/pr68198.c: Update jump threading expectations.\n>>>>>>>>         * gcc.dg/tree-ssa/switch-expansion.c: New test.\n>>>>>>>>         * gcc.dg/tree-ssa/vrp34.c: Update scanned pattern.\n>>>>>>>>         * g++.dg/other/pr82032.C: New test.\n>>>>>>>> ---\n>>>>>>>>  gcc/testsuite/g++.dg/other/pr82032.C             |  36 +++++++\n>>>>>>>>  gcc/testsuite/gcc.dg/tree-ssa/pr68198.c          |   6 +-\n>>>>>>>>  gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c |  14 +++\n>>>>>>>>  gcc/testsuite/gcc.dg/tree-ssa/vrp34.c            |   5 +-\n>>>>>>>>  gcc/tree-switch-conversion.c                     | 123 ++++++++++++++++++-----\n>>>>>>>>  5 files changed, 152 insertions(+), 32 deletions(-)\n>>>>>>>>  create mode 100644 gcc/testsuite/g++.dg/other/pr82032.C\n>>>>>>>>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c\n>>>>>>>>\n>>>>>>>>\n>>>>>>\n>>>>\n>>\nFrom 706b76ac44a8e6359cd12d2ebaef79a2bbba707d Mon Sep 17 00:00:00 2001\nFrom: marxin <mliska@suse.cz>\nDate: Fri, 1 Sep 2017 12:52:31 +0200\nSubject: [PATCH] Learn CFG cleanup to transform single case switches to gcond.\n\ngcc/ChangeLog:\n\n2017-09-01  Martin Liska  <mliska@suse.cz>\n\n\t* tree-cfg.c (generate_high_low_equality): New function.\n\t* tree-cfg.h (generate_high_low_equality): Declared here.\n\t* tree-cfgcleanup.c (convert_single_case_switch): New function.\n\t(cleanup_control_expr_graph): Use it.\n\t* tree-switch-conversion.c (try_switch_expansion): Remove\n\tassert.\n\t(emit_case_nodes): Use generate_high_low_equality.\n\ngcc/testsuite/ChangeLog:\n\n2017-09-01  Martin Liska  <mliska@suse.cz>\n\n\t* g++.dg/other/pr82032.C: New test.\n\t* gcc.dg/tree-ssa/pr68198.c: Update scanned pattern.\n\t* gcc.dg/tree-ssa/vrp34.c: Likewise.\n\t* gcc.dg/switch-10.c: Likewise.\n---\n gcc/testsuite/g++.dg/other/pr82032.C    | 36 ++++++++++++++++++++++++\n gcc/testsuite/gcc.dg/switch-10.c        |  5 ++--\n gcc/testsuite/gcc.dg/tree-ssa/pr68198.c |  6 ++--\n gcc/testsuite/gcc.dg/tree-ssa/vrp34.c   |  5 ++--\n gcc/tree-cfg.c                          | 25 +++++++++++++++++\n gcc/tree-cfg.h                          |  2 ++\n gcc/tree-cfgcleanup.c                   | 49 +++++++++++++++++++++++++++++++++\n gcc/tree-switch-conversion.c            | 27 ++++--------------\n 8 files changed, 126 insertions(+), 29 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/other/pr82032.C\n\ndiff --git a/gcc/testsuite/g++.dg/other/pr82032.C b/gcc/testsuite/g++.dg/other/pr82032.C\nnew file mode 100644\nindex 00000000000..607bf85c8e1\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/other/pr82032.C\n@@ -0,0 +1,36 @@\n+/* { dg-do compile } */\n+/* { dg-options \"-O3 -Wno-return-type\" } */\n+\n+template <typename a> class b\n+{\n+public:\n+  typename a::aa operator[] (typename a::c) { }\n+};\n+class d\n+{\n+public:\n+  typedef long c;\n+  typedef int aa;\n+};\n+struct e\n+{\n+  int af[4];\n+  int ag;\n+};\n+b<d> f;\n+bool\n+g (e &i)\n+{\n+  for (int h; h; ++h)\n+    switch (f[h])\n+      {\n+      case 'x':\n+      case 'a':\n+\ti.af[h] = 3;\n+\tbreak;\n+      default:\n+\treturn false;\n+      }\n+\n+  return true;\n+}\ndiff --git a/gcc/testsuite/gcc.dg/switch-10.c b/gcc/testsuite/gcc.dg/switch-10.c\nindex 0ffc9eb5757..9e5926745b8 100644\n--- a/gcc/testsuite/gcc.dg/switch-10.c\n+++ b/gcc/testsuite/gcc.dg/switch-10.c\n@@ -1,6 +1,4 @@\n /* { dg-options \"-O2 -fdump-tree-cfg\" }  */\n-/* { dg-final { scan-tree-dump \"case 0:\" \"cfg\" } }  */\n-/* { dg-final { scan-tree-dump-not \"case 1 ... 255:\" \"cfg\" } }  */\n #include <stdint.h>\n \n void foo (void);\n@@ -20,3 +18,6 @@ test (uint8_t ch)\n      break;\n    }\n }\n+\n+/* Switch statement is converted to GIMPLE condition.  */\n+/* { dg-final { scan-tree-dump-not \"switch\" \"cfg\" } }  */\ndiff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr68198.c b/gcc/testsuite/gcc.dg/tree-ssa/pr68198.c\nindex 16097d7e2bc..59d562e156c 100644\n--- a/gcc/testsuite/gcc.dg/tree-ssa/pr68198.c\n+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr68198.c\n@@ -37,7 +37,5 @@ c_finish_omp_clauses (tree clauses)\n     }\n }\n \n-/* There are 3 FSM jump threading opportunities, two of which will\n-  get filtered out.  */\n-/* { dg-final { scan-tree-dump-times \"Registering FSM\" 1 \"thread1\"} } */\n-/* { dg-final { scan-tree-dump-times \"FSM Thread through multiway branch without threading a multiway branch\" 2 \"thread1\"} } */\n+/* There are 3 FSM jump threading opportunities.  */\n+/* { dg-final { scan-tree-dump-times \"Registering FSM\" 3 \"thread1\"} } */\ndiff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp34.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp34.c\nindex 142e56c1641..d2a36a706f2 100644\n--- a/gcc/testsuite/gcc.dg/tree-ssa/vrp34.c\n+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp34.c\n@@ -15,5 +15,6 @@ foo (int a)\n     }\n }\n \n-/* Both ifs should be optimized.  */\n-/* { dg-final { scan-tree-dump-times \"if \\\\\\(\" 0 \"vrp1\" } } */\n+/* Both ifs should be optimized (and switch statement will be the only if\n+   in the function).  */\n+/* { dg-final { scan-tree-dump-times \"if \\\\\\(\" 1 \"vrp1\" } } */\ndiff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c\nindex b7593068ea9..8ab509bf0cb 100644\n--- a/gcc/tree-cfg.c\n+++ b/gcc/tree-cfg.c\n@@ -8927,7 +8927,32 @@ extract_true_false_controlled_edges (basic_block dom, basic_block phiblock,\n   return true;\n }\n \n+/* Generate GIMPLE IL to basic block BB which compares whether INDEX\n+   value is within range LOW ... HIGH.  We create a LHS and RHS that\n+   can be then compared in order to hit the interval or not.  */\n \n+void\n+generate_high_low_equality (basic_block bb, tree index, tree low, tree high,\n+\t\t\t    tree *lhs, tree *rhs)\n+{\n+  tree type = TREE_TYPE (index);\n+  tree utype = unsigned_type_for (type);\n+\n+  low = fold_convert (type, low);\n+  high = fold_convert (type, high);\n+\n+  tree tmp = make_ssa_name (type);\n+  gassign *sub1\n+    = gimple_build_assign (tmp, MINUS_EXPR, index, low);\n+\n+  *lhs = make_ssa_name (utype);\n+  gassign *a = gimple_build_assign (*lhs, NOP_EXPR, tmp);\n+\n+  *rhs = fold_build2 (MINUS_EXPR, utype, high, low);\n+  gimple_stmt_iterator gsi = gsi_last_bb (bb);\n+  gsi_insert_before (&gsi, sub1, GSI_SAME_STMT);\n+  gsi_insert_before (&gsi, a, GSI_SAME_STMT);\n+}\n \n /* Emit return warnings.  */\n \ndiff --git a/gcc/tree-cfg.h b/gcc/tree-cfg.h\nindex 66be43657bc..ad52c448947 100644\n--- a/gcc/tree-cfg.h\n+++ b/gcc/tree-cfg.h\n@@ -109,6 +109,8 @@ extern basic_block insert_cond_bb (basic_block, gimple *, gimple *,\n extern bool gimple_find_sub_bbs (gimple_seq, gimple_stmt_iterator *);\n extern bool extract_true_false_controlled_edges (basic_block, basic_block,\n \t\t\t\t\t\t edge *, edge *);\n+extern void generate_high_low_equality (basic_block bb, tree index, tree low,\n+\t\t\t\t\ttree high, tree *lhs, tree *rhs);\n \n /* Return true if the LHS of a call should be removed.  */\n \ndiff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c\nindex c6e5c8da03c..67f392c97dd 100644\n--- a/gcc/tree-cfgcleanup.c\n+++ b/gcc/tree-cfgcleanup.c\n@@ -74,6 +74,49 @@ remove_fallthru_edge (vec<edge, va_gc> *ev)\n   return false;\n }\n \n+/* Convert a SWTCH with single non-default case to gcond and replace it\n+   at GSI.  */\n+\n+static bool\n+convert_single_case_switch (gswitch *swtch, gimple_stmt_iterator &gsi)\n+{\n+  if (gimple_switch_num_labels (swtch) != 2)\n+    return false;\n+\n+  tree index = gimple_switch_index (swtch);\n+  tree default_label = CASE_LABEL (gimple_switch_default_label (swtch));\n+  tree label = gimple_switch_label (swtch, 1);\n+  tree low = CASE_LOW (label);\n+  tree high = CASE_HIGH (label);\n+\n+  basic_block default_bb = label_to_block_fn (cfun, default_label);\n+  basic_block case_bb = label_to_block_fn (cfun, CASE_LABEL (label));\n+\n+  basic_block bb = gimple_bb (swtch);\n+  gcond *cond;\n+\n+  /* Replace switch statement with condition statement.  */\n+  if (high)\n+    {\n+      tree lhs, rhs;\n+      generate_high_low_equality (bb, index, low, high, &lhs, &rhs);\n+      cond = gimple_build_cond (LE_EXPR, lhs, rhs, NULL_TREE, NULL_TREE);\n+    }\n+  else\n+    cond = gimple_build_cond (EQ_EXPR, index,\n+\t\t\t      fold_convert (TREE_TYPE (index), low),\n+\t\t\t      NULL_TREE, NULL_TREE);\n+\n+  gsi_replace (&gsi, cond, true);\n+\n+  /* Update edges.  */\n+  edge case_edge = find_edge (bb, case_bb);\n+  edge default_edge = find_edge (bb, default_bb);\n+\n+  case_edge->flags |= EDGE_TRUE_VALUE;\n+  default_edge->flags |= EDGE_FALSE_VALUE;\n+  return true;\n+}\n \n /* Disconnect an unreachable block in the control expression starting\n    at block BB.  */\n@@ -93,6 +136,12 @@ cleanup_control_expr_graph (basic_block bb, gimple_stmt_iterator gsi,\n       bool warned;\n       tree val = NULL_TREE;\n \n+      /* Try to convert a switch with just a single non-default case to\n+\t GIMPLE condition.  */\n+      if (gimple_code (stmt) == GIMPLE_SWITCH\n+\t  && convert_single_case_switch (as_a<gswitch *> (stmt), gsi))\n+\tstmt = gsi_stmt (gsi);\n+\n       fold_defer_overflow_warnings ();\n       switch (gimple_code (stmt))\n \t{\ndiff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c\nindex d0d08972804..36bac0dd1e5 100644\n--- a/gcc/tree-switch-conversion.c\n+++ b/gcc/tree-switch-conversion.c\n@@ -2057,9 +2057,8 @@ try_switch_expansion (gswitch *stmt)\n      expressions being INTEGER_CST.  */\n   gcc_assert (TREE_CODE (index_expr) != INTEGER_CST);\n \n-  /* Optimization of switch statements with only one label has already\n-     occurred, so we should never see them at this point.  */\n-  gcc_assert (ncases > 1);\n+  if (ncases == 1)\n+    return false;\n \n   /* Find the default case target label.  */\n   tree default_label = CASE_LABEL (gimple_switch_default_label (stmt));\n@@ -2701,27 +2700,13 @@ emit_case_nodes (basic_block bb, tree index, case_node_ptr node,\n \t    }\n \t  else if (!low_bound && !high_bound)\n \t    {\n-\t      tree type = TREE_TYPE (index);\n-\t      tree utype = unsigned_type_for (type);\n-\n-\t      tree lhs = make_ssa_name (type);\n-\t      gassign *sub1\n-\t\t= gimple_build_assign (lhs, MINUS_EXPR, index, node->low);\n-\n-\t      tree converted = make_ssa_name (utype);\n-\t      gassign *a = gimple_build_assign (converted, NOP_EXPR, lhs);\n-\n-\t      tree rhs = fold_build2 (MINUS_EXPR, utype,\n-\t\t\t\t      fold_convert (type, node->high),\n-\t\t\t\t      fold_convert (type, node->low));\n-\t      gimple_stmt_iterator gsi = gsi_last_bb (bb);\n-\t      gsi_insert_before (&gsi, sub1, GSI_SAME_STMT);\n-\t      gsi_insert_before (&gsi, a, GSI_SAME_STMT);\n-\n+\t      tree lhs, rhs;\n+\t      generate_high_low_equality (bb, index, node->low, node->high,\n+\t\t\t\t\t  &lhs, &rhs);\n \t      probability\n \t\t= conditional_probability (default_prob,\n \t\t\t\t\t   subtree_prob + default_prob);\n-\t      bb = emit_cmp_and_jump_insns (bb, converted, rhs, GT_EXPR,\n+\t      bb = emit_cmp_and_jump_insns (bb, lhs, rhs, GT_EXPR,\n \t\t\t\t\t    default_bb, probability,\n \t\t\t\t\t    phi_mapping);\n \t    }","headers":{"Return-Path":"<gcc-patches-return-461282-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461282-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"Mwc6qOs3\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkKBq0NTFz9s83\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 23:01:54 +1000 (AEST)","(qmail 103820 invoked by alias); 1 Sep 2017 13:01:46 -0000","(qmail 103774 invoked by uid 89); 1 Sep 2017 13:01:45 -0000","from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 01 Sep 2017 13:01:42 +0000","from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx1.suse.de (Postfix) with ESMTP id 34FDFAC0F;\n\tFri,  1 Sep 2017 13:01:40 +0000 (UTC)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type; q=dns; s=default; b=YM1GcdTun2yBVS2uh\n\tPmA/7yaMwAYas/oP1XEuZLif2glc0r8b6VaXcZQgRKffXo7iLlyrOexkzTBtZmEI\n\tgREIyCQY6auSOxyIxCoTJGFKnAAUKO2t6eul1eok4p4OUmkns6ITD0erElIB2/34\n\tzzhh5MD2jPMJ2I963L1Bg9vSSY=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:subject:to:cc:references:from:message-id:date:mime-version\n\t:in-reply-to:content-type; s=default; bh=TnBNV36w/tdROzNnyGTU7wM\n\tVLU0=; b=Mwc6qOs3aSn04TFYjRqwstrbV5Dbo6iwlGRfRqbKKe7p8fH51rh0Kbn\n\t/roheMNNBm0inXlHxlsCDzbVo7gJFvkGzJS2GUm+UM8Kj0NE/4Fxgmu0P5P+J8PF\n\t1jhyADGWoBRKxLQ0qrwj9DMv/0dexdPoqTkOq5pr3c0IyDLzCO9o=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mx1.suse.de","Subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","To":"Richard Biener <richard.guenther@gmail.com>","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","References":"<bde90963-7695-89d5-6792-e8f803f71160@suse.cz>\n\t<CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com>\n\t<b9003663-ce11-8f29-6ebb-624077b53157@suse.cz>\n\t<CAFiYyc3VE78iX+sgXoz_DKYP-LWdxBrE=D5WjBRN-e45xZdyGw@mail.gmail.com>\n\t<60ea6209-3b23-6398-da99-19326e24d8c2@suse.cz>\n\t<CAFiYyc3pwpXW_2xEYO_fjbT=HHETJsrbq8kW_jbLHZFxZFmGbg@mail.gmail.com>\n\t<ad30c64e-29c6-ccbd-bc94-ffb5926f2b39@suse.cz>\n\t<CAFiYyc0bKTdxLsXW=ZDose8peoOV_Qw+518+A8YEwjX+q-tv=g@mail.gmail.com>","From":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Message-ID":"<bc2320ae-8896-336f-2d34-f1a0977b5044@suse.cz>","Date":"Fri, 1 Sep 2017 15:01:39 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<CAFiYyc0bKTdxLsXW=ZDose8peoOV_Qw+518+A8YEwjX+q-tv=g@mail.gmail.com>","Content-Type":"multipart/mixed;\n\tboundary=\"------------A7C5C97E01E0B472C437F904\"","X-IsSubscribed":"yes"}},{"id":1762595,"web_url":"http://patchwork.ozlabs.org/comment/1762595/","msgid":"<CAFiYyc1wb-o245TPL9CB_GsSz8-dmSr2o-yOXD0We3SCjKk4-A@mail.gmail.com>","list_archive_url":null,"date":"2017-09-04T11:57:15","subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","submitter":{"id":1765,"url":"http://patchwork.ozlabs.org/api/people/1765/","name":"Richard Biener","email":"richard.guenther@gmail.com"},"content":"On Fri, Sep 1, 2017 at 3:01 PM, Martin Liška <mliska@suse.cz> wrote:\n> On 09/01/2017 12:57 PM, Richard Biener wrote:\n>> On Fri, Sep 1, 2017 at 12:44 PM, Martin Liška <mliska@suse.cz> wrote:\n>>> On 09/01/2017 10:26 AM, Richard Biener wrote:\n>>>> On Fri, Sep 1, 2017 at 10:07 AM, Martin Liška <mliska@suse.cz> wrote:\n>>>>> On 08/30/2017 02:56 PM, Richard Biener wrote:\n>>>>>> On Wed, Aug 30, 2017 at 2:32 PM, Martin Liška <mliska@suse.cz> wrote:\n>>>>>>> On 08/30/2017 02:28 PM, Richard Biener wrote:\n>>>>>>>> On Wed, Aug 30, 2017 at 1:13 PM, Martin Liška <mliska@suse.cz> wrote:\n>>>>>>>>> Hi.\n>>>>>>>>>\n>>>>>>>>> Simple transformation of switch statements where degenerated switch can be interpreted\n>>>>>>>>> as gimple condition (or removed if having any non-default case). I originally though\n>>>>>>>>> that we don't have switch statements without non-default cases, but PR82032 shows we\n>>>>>>>>> can see it.\n>>>>>>>>>\n>>>>>>>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n>>>>>>>>>\n>>>>>>>>> Ready to be installed?\n>>>>>>>>\n>>>>>>>> While I guess this case is ok to handle here it would be nice if CFG cleanup\n>>>>>>>> would do the same.  I suppose find_taken_edge somehow doesn't work for\n>>>>>>>> this case even after my last enhancement?  Or is CFG cleanup for some reason\n>>>>>>>> not run?\n>>>>>>>\n>>>>>>> Do you mean both with # of non-default edges equal to 0 and 1?\n>>>>>>> Let me take a look.\n>>>>>>\n>>>>>> First and foremost 0.  The case of 1 non-default and a default would\n>>>>>> need extra code.\n>>>>>\n>>>>> For the test-case I reduced, one needs:\n>>>>>\n>>>>> diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c\n>>>>> index b7593068ea9..13af516c6ac 100644\n>>>>> --- a/gcc/tree-cfg.c\n>>>>> +++ b/gcc/tree-cfg.c\n>>>>> @@ -8712,7 +8712,7 @@ const pass_data pass_data_split_crit_edges =\n>>>>>    PROP_no_crit_edges, /* properties_provided */\n>>>>>    0, /* properties_destroyed */\n>>>>>    0, /* todo_flags_start */\n>>>>> -  0, /* todo_flags_finish */\n>>>>> +  TODO_cleanup_cfg, /* todo_flags_finish */\n>>>>>  };\n>>>>>\n>>>>>  class pass_split_crit_edges : public gimple_opt_pass\n>>>>>\n>>>>> And the code eliminates the problematic switch statement. Do you believe it's the right approach\n>>>>> to add the clean up and preserve the assert in tree-switch-conversion.c?\n>>>>\n>>>> Eh, no.  If you run cleanup-cfg after critical edge splitting they\n>>>> will be unsplit immediately, making\n>>>> it (mostly) a no-op.\n>>>>\n>>>> OTOH I wanted to eliminate that \"pass\" in favor of just calling\n>>>> split_critical_edges () where needed\n>>>> (that's already done in some places).\n>>>\n>>> Good, so I will leave it to you. Should I in meantime remove the assert in tree-switch-conversion.c ?\n>>\n>> Yes, as said your patch was generally OK, I just wondered why we left\n>> the switches \"unoptimized\".\n>\n> Good.\n>\n> I'm sending v2 for single non-default case situation.\n> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.\n>\n> Ready to be installed?\n\nSome style nits.  generate_high_low_equality is a bit cumbersome I think\nand I'd prefer\n\n/* Generate a range test LHS CODE RHS that determines whether INDEX is in the\n    range [low, high].  Place associated stmts before *GSI.  */\n\nvoid\ngenerate_range_test (gimple_stmt_iterator *gsi, tree index, wide_int\nlow, wide_int high,\n                                enum tree_code *code, tree *lhs, tree *rhs)\n{\n}\n\nthis captures the implicit requirement of constant low/high (otherwise\nyou'll generate invalid GIMPLE)\nand it makes the comparison code explicit -- otherwise a user has to\ninspect users or decipher\nthe function.  Note you'll need to use wi::from (low, TYPE_PRECISION\n(TREE_TYPE (index)), SIGNED/UNSIGNED)\nto get at the promoted wide-ints/trees.\n\nOtherwise it looks reasonable.\n\nNot super-happy with the tree-cfg.c location for the helper but I\ndon't have anything more\nappropriate either.\n\nThanks,\nRichard.\n\n\n> Martin\n>\n>>\n>> Richard.\n>>\n>>>>\n>>>>> For the case with # of edges == 1, should I place it to tree-cfg.c in order to trigger it as a clean-up?\n>>>>\n>>>> I believe the code for edges == 1 can reside in\n>>>> cleanup_control_expr_graph.  Probably easiest\n>>>> from a flow perspective if we do the switch -> cond transform before\n>>>> the existing code handling\n>>>> cond and switch via find-taken-edge.\n>>>\n>>> Working on that, good place to do the transformation.\n>>>\n>>> Martin\n>>>\n>>>>\n>>>>> Thoughts?\n>>>>>\n>>>>> Martin\n>>>>>\n>>>>>>\n>>>>>> Richard.\n>>>>>>\n>>>>>>> Martin\n>>>>>>>\n>>>>>>>>\n>>>>>>>> Richard.\n>>>>>>>>\n>>>>>>>>> Martin\n>>>>>>>>>\n>>>>>>>>> gcc/ChangeLog:\n>>>>>>>>>\n>>>>>>>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>>>>>>>\n>>>>>>>>>         PR tree-optimization/82032\n>>>>>>>>>         * tree-switch-conversion.c (generate_high_low_equality): New\n>>>>>>>>>         function.\n>>>>>>>>>         (expand_degenerated_switch): Likewise.\n>>>>>>>>>         (process_switch): Call expand_degenerated_switch.\n>>>>>>>>>         (try_switch_expansion): Likewise.\n>>>>>>>>>         (emit_case_nodes): Use generate_high_low_equality.\n>>>>>>>>>\n>>>>>>>>> gcc/testsuite/ChangeLog:\n>>>>>>>>>\n>>>>>>>>> 2017-08-25  Martin Liska  <mliska@suse.cz>\n>>>>>>>>>\n>>>>>>>>>         PR tree-optimization/82032\n>>>>>>>>>         * gcc.dg/tree-ssa/pr68198.c: Update jump threading expectations.\n>>>>>>>>>         * gcc.dg/tree-ssa/switch-expansion.c: New test.\n>>>>>>>>>         * gcc.dg/tree-ssa/vrp34.c: Update scanned pattern.\n>>>>>>>>>         * g++.dg/other/pr82032.C: New test.\n>>>>>>>>> ---\n>>>>>>>>>  gcc/testsuite/g++.dg/other/pr82032.C             |  36 +++++++\n>>>>>>>>>  gcc/testsuite/gcc.dg/tree-ssa/pr68198.c          |   6 +-\n>>>>>>>>>  gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c |  14 +++\n>>>>>>>>>  gcc/testsuite/gcc.dg/tree-ssa/vrp34.c            |   5 +-\n>>>>>>>>>  gcc/tree-switch-conversion.c                     | 123 ++++++++++++++++++-----\n>>>>>>>>>  5 files changed, 152 insertions(+), 32 deletions(-)\n>>>>>>>>>  create mode 100644 gcc/testsuite/g++.dg/other/pr82032.C\n>>>>>>>>>  create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/switch-expansion.c\n>>>>>>>>>\n>>>>>>>>>\n>>>>>>>\n>>>>>\n>>>\n>","headers":{"Return-Path":"<gcc-patches-return-461413-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461413-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"g+FcAu/X\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xm7dD0cRRz9sNc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon,  4 Sep 2017 21:57:33 +1000 (AEST)","(qmail 7339 invoked by alias); 4 Sep 2017 11:57:25 -0000","(qmail 6762 invoked by uid 89); 4 Sep 2017 11:57:23 -0000","from mail-wm0-f50.google.com (HELO mail-wm0-f50.google.com)\n\t(74.125.82.50) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 04 Sep 2017 11:57:18 +0000","by mail-wm0-f50.google.com with SMTP id 137so15156836wmj.1 for\n\t<gcc-patches@gcc.gnu.org>; Mon, 04 Sep 2017 04:57:17 -0700 (PDT)","by 10.80.180.205 with HTTP; Mon, 4 Sep 2017 04:57:15 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; q=dns; s=\n\tdefault; b=lNdss2BKKmk/LO3JLlhjh9AYes+fLlLuAI1cUXd7X1c6h86csBjBb\n\tcV40pqRA9BJZ8T9ZlfIfAJSBMU3OOa9z59NzGfBzhBOG8ukj9uXoS9IOujpXfgzX\n\tDzSBNbkUbPJay0Q2lelQrEkzVATwjv/Y/lnoyANeTqtaLpSNkQRYOA=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type:content-transfer-encoding; s=\n\tdefault; bh=9og4TM8T3F7ZXOpL8mCS2Y1iDdM=; b=g+FcAu/XOxICRjWpTHPd\n\te1fNxY7HnPGJ8hlAkiyguXH/rfidKzhAbBfKqT+jb5ZQoOeUzPX24IlpqQzEseUX\n\tMSy4e3E/fAqr73KsuuH0kk2VQ0inB5+hGRvaKNPx0dPro1OtRzra1+/R9JcPCsSX\n\tSrUoYuOAnWgaAYW9E+32Pxo=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-24.5 required=5.0 tests=AWL, BAYES_00,\n\tFREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2,\n\tGIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=foremost, Ready,\n\t(unknown)","X-HELO":"mail-wm0-f50.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=v+hC1xM39p6NSIaJdWYEN7YFM8EO5AjGk5N92H0rWyA=;\n\tb=rgHy4jFUfZZcVjTwbl+2pR9IIa/Hei7//GdW7P4kyrh+HoZGVT2hG77NIiuDd6gzNz\n\trzajGgpeOlYpnE7OGp+JtxCmyBDHlv3aeMRVvOLWGB4QsZf176qIR1tiZkfdBlfY1Imq\n\t4gorAwOfrSj4eeeBL1XdMyxN9OvH0jIjVekd+5IEkJN8jVkdgxdHXN6L/yUMsbhVkGqt\n\tgodwY7hy0WHWqzkKrBDL3aeXD567/3tY23mYDiT72Rvj7kztNMEBGPfXDDLDV/DzUwba\n\tOAGCcwotGY/2aQ1tXTKyK5HgGEZ7aWX2qlQFhDfb6s9vzDzWPSqTrCzJTLIQIEGXZLmX\n\tBNcA==","X-Gm-Message-State":"AHPjjUjGPafQolplmdtvfQdlll+TGFDLc59Np91VXmq6gb2WT6UG+4Cm\tJNw0Lg3N9b1Gqyy4DQA7iEfQ1zgxCw==","X-Google-Smtp-Source":"ADKCNb7NS9k/lqXDlrsB3Gf5RfPIdSw55IB3HTuwGpG1uDnMyjSnHaz668Euwy/tHoawny1NkrWsczVO8szqd+m/IPk=","X-Received":"by 10.80.240.26 with SMTP id r26mr345669edl.142.1504526235883;\n\tMon, 04 Sep 2017 04:57:15 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<bc2320ae-8896-336f-2d34-f1a0977b5044@suse.cz>","References":"<bde90963-7695-89d5-6792-e8f803f71160@suse.cz>\n\t<CAFiYyc0bNt7Ysumz_ZVXW8uiMpCAfDhPKZatiGMET6rRNiXRtQ@mail.gmail.com>\n\t<b9003663-ce11-8f29-6ebb-624077b53157@suse.cz>\n\t<CAFiYyc3VE78iX+sgXoz_DKYP-LWdxBrE=D5WjBRN-e45xZdyGw@mail.gmail.com>\n\t<60ea6209-3b23-6398-da99-19326e24d8c2@suse.cz>\n\t<CAFiYyc3pwpXW_2xEYO_fjbT=HHETJsrbq8kW_jbLHZFxZFmGbg@mail.gmail.com>\n\t<ad30c64e-29c6-ccbd-bc94-ffb5926f2b39@suse.cz>\n\t<CAFiYyc0bKTdxLsXW=ZDose8peoOV_Qw+518+A8YEwjX+q-tv=g@mail.gmail.com>\n\t<bc2320ae-8896-336f-2d34-f1a0977b5044@suse.cz>","From":"Richard Biener <richard.guenther@gmail.com>","Date":"Mon, 4 Sep 2017 13:57:15 +0200","Message-ID":"<CAFiYyc1wb-o245TPL9CB_GsSz8-dmSr2o-yOXD0We3SCjKk4-A@mail.gmail.com>","Subject":"Re: [PATCH] Expand switch statements with a single (or none)\n\tnon-default case.","To":"=?utf-8?q?Martin_Li=C5=A1ka?= <mliska@suse.cz>","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-IsSubscribed":"yes"}}]