From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 634283858D39 for ; Thu, 3 Nov 2022 13:43:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 634283858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2308C1FB; Thu, 3 Nov 2022 06:43:24 -0700 (PDT) Received: from [10.57.7.219] (unknown [10.57.7.219]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D7C033F534; Thu, 3 Nov 2022 06:43:16 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------PEApvVCTXq2hostOuVtwiMF0" Message-ID: <785436fa-0ef9-e424-030d-f7b2bdf9c935@arm.com> Date: Thu, 3 Nov 2022 13:43:06 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Cc: Richard Biener , Richard Sandiford From: "Andre Vieira (lists)" Subject: [PATCH] ifcvt: Support bitfield lowering of multiple-exit loops X-Spam-Status: No, score=-16.9 required=5.0 tests=BAYES_00,BODY_8BITS,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_LOTSOFHASH,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is a multi-part message in MIME format. --------------PEApvVCTXq2hostOuVtwiMF0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, With Tamar's patch (https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604880.html) enabling the vectorization of early-breaks, I'd like to allow bitfield lowering in such loops, which requires the relaxation of allowing multiple exits when doing so.  In order to avoid a similar issue to PR107275, I hoisted the code that rejects loops with certain types of gimple_stmts from 'if_convertible_loop_p_1' to 'get_loop_body_in_if_conv_order', to avoid trying to lower bitfields in loops we are not going to vectorize anyway.  This also ensures 'ifcvt_local_dce' doesn't accidentally remove statements it shouldn't as it will never come across them.  I made sure to add a comment to make clear that there is a direct connection between the two and if we were to enable vectorization of any other gimple statement we should make sure both handle it. Bootstrapped and regression tested on aarch64-none-linux-gnu and x86_64-pc-linux-gnu gcc/ChangeLog:         * tree-if-conv.cc (if_convertible_loop_p_1): Move statement check loop from here ...         (get_loop_body_if_conv_order): ... to here.         (if_convertible_loop_p): Remove single_exit check.         (tree_if_conversion): Move single_exit check to if-conversion part. gcc/testsuite/ChangeLog:         * gcc.dg/vect/vect-bitfield-read-1-not.c: New test.         * gcc.dg/vect/vect-bitfield-read-2-not.c: New test.         * gcc.dg/vect/vect-bitfield-read-8.c: New test.         * gcc.dg/vect/vect-bitfield-read-9.c: New test. --------------PEApvVCTXq2hostOuVtwiMF0 Content-Type: text/plain; charset=UTF-8; name="lower_bitfield_multiple_exits.patch" Content-Disposition: attachment; filename="lower_bitfield_multiple_exits.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2djYy90ZXN0c3VpdGUvZ2NjLmRnL3ZlY3QvdmVjdC1iaXRmaWVsZC1y ZWFkLTEtbm90LmMgYi9nY2MvdGVzdHN1aXRlL2djYy5kZy92ZWN0L3ZlY3QtYml0ZmllbGQt cmVhZC0xLW5vdC5jCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAwMDAwMDAw MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAuLjBkOTEwNjdlYmIyN2IxZGIyYjIzNTI5NzVj NDNiY2U4YjQxNzF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