From patchwork Mon Jun 5 05:53:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 103086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2473678vqr; Sun, 4 Jun 2023 22:54:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ht/Z2+xQF9HbaQj+8UCf2qjKnc4TzNwSHHe/Oxu0wK/MwDSb9kpZCbX3RgkPMcRD/ExeT X-Received: by 2002:a17:907:3e1e:b0:973:d857:9a33 with SMTP id hp30-20020a1709073e1e00b00973d8579a33mr5550694ejc.11.1685944490254; Sun, 04 Jun 2023 22:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685944490; cv=none; d=google.com; s=arc-20160816; b=bwMUH3e2VZ/61QzYd5tpUw4xNFU+Zai+D8jFIcpRSl79FCDcy0RZMXkVueKHcl81QP hA8GaE1hBd4e0cZK94jURmM+Qje/3fJJRsaRInP2WEzGKSDdblPO5AiHN7B89oB7J7bx 1BZcmkdpNMgbJoZ3JCSGSbJ3nv2Vm2oyzsmkamIwj8j4u9dBEqP/KjAugRMdXrFGiaU1 8Tg6BMOu08VF0ylNLlJKNRhnyylADETIIzcy9fdyaCytY9AT8/zHRo0U2Git10ALzPDg Ee7UAxVH1M7tHNiu1RwCbEuKLe5/8Y92rZn9au/stMF+JzpixEbcyl1Z2PV6zpIwH9Bh YW4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=8ENLvHp9UqS+Lsdgk0t9HoL/4d4Xppd0saDIWAphxlY=; b=UWXJBSJ3Vu4oSYRDjSknAxErh39NhxQzcKWZqQ/LHTnWRCGNkL+8173k5WtQwe2+Qc YVTLJMImt86U0ftI+xndzj3a9K15z51Vv1XfJ1BuQdyXR3X86JhwaPhIcBYcfh3g4Jsz ZODNqcB/Ie33QlKN2GtH2O5LWMv8MWCgxBQBCuGSBwr/ta7A3aT6T7qUmK/9Z9q5X2dZ Vl6u8a/S8r5NBs6RZXQfCAp30ZfBRSSgEzb0F20f4rC/fwPTGeAu2RJaNNEtw0dxfICD 29jBeTJHwQCXZtr7M4yJmf8GNx1W9S7cyfTFVT/N9pxbHImwWPCJKUxuMsl3IanMkZ5y Xq2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ynyhojCK; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id 29-20020a170906225d00b0096f61c20399si4647064ejr.689.2023.06.04.22.54.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jun 2023 22:54:50 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ynyhojCK; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 64D30385660D for ; Mon, 5 Jun 2023 05:54:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 64D30385660D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685944480; bh=8ENLvHp9UqS+Lsdgk0t9HoL/4d4Xppd0saDIWAphxlY=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ynyhojCKWHHzpx2wMrclp0q4JozhuSFLeP+Cy16CC7HPDdY+TqwzurIcFyWQIsUlq p8V3YgqAdQ1CW64XdfOmDVJqgJnXsIdsvUIyNYNf3AZUvLbrOAuBTMgBK6Et5NHtCP b0ATMO20btJvWKAbtRCi7r/lV0JLtHO6uwU9R71Q= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id 634CD3858401 for ; Mon, 5 Jun 2023 05:53:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 634CD3858401 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 354KeHLP015673 for ; Sun, 4 Jun 2023 22:53:56 -0700 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3r02vpda1j-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sun, 04 Jun 2023 22:53:56 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 4 Jun 2023 22:53:55 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sun, 4 Jun 2023 22:53:55 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id DFA0F3F704A; Sun, 4 Jun 2023 22:53:54 -0700 (PDT) To: CC: Andrew Pinski Subject: [PATCH 1/2] Improve do_store_flag for single bit when there is no non-zero bits Date: Sun, 4 Jun 2023 22:53:30 -0700 Message-ID: <20230605055331.2864335-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Proofpoint-GUID: oxDWcxofHo5L3OtPZ-Mju7SnL79a0nQe X-Proofpoint-ORIG-GUID: oxDWcxofHo5L3OtPZ-Mju7SnL79a0nQe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-03_08,2023-06-02_02,2023-05-22_02 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Pinski via Gcc-patches From: Andrew Pinski Reply-To: Andrew Pinski Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767840929844887208?= X-GMAIL-MSGID: =?utf-8?q?1767840929844887208?= In r14-1534-g908e5ab5c11c, I forgot you could turn off CCP or turn off the bit tracking part of CCP so we would lose out what TER was able to do before hand. This moves around the TER code so that it is used instead of just the nonzerobits. It also makes it easier to remove the TER part of the code later on too. OK? Bootstrapped and tested on x86_64-linux-gnu. Note it reintroduces PR 110117 (which was accidently fixed after r14-1534-g908e5ab5c11c). The next patch in series will fix that. gcc/ChangeLog: * expr.cc (do_store_flag): Rearrange the TER code so that it overrides the nonzero bits info if we had `a & POW2`. --- gcc/expr.cc | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/gcc/expr.cc b/gcc/expr.cc index 58f5fe76372..ca008cd453e 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -13164,38 +13164,32 @@ do_store_flag (sepops ops, rtx target, machine_mode mode) && (TYPE_PRECISION (ops->type) != 1 || TYPE_UNSIGNED (ops->type))) { wide_int nz = tree_nonzero_bits (arg0); + gimple *srcstmt = get_def_for_expr (arg0, BIT_AND_EXPR); + /* If the defining statement was (x & POW2), then use that instead of + the non-zero bits. */ + if (srcstmt && integer_pow2p (gimple_assign_rhs2 (srcstmt))) + { + nz = wi::to_wide (gimple_assign_rhs2 (srcstmt)); + arg0 = gimple_assign_rhs1 (srcstmt); + } if (wi::popcount (nz) == 1 && (integer_zerop (arg1) || wi::to_wide (arg1) == nz)) { - tree op0; - int bitnum; - gimple *srcstmt = get_def_for_expr (arg0, BIT_AND_EXPR); - /* If the defining statement was (x & POW2), then remove the and - as we are going to add it back. */ - if (srcstmt - && integer_pow2p (gimple_assign_rhs2 (srcstmt))) - { - op0 = gimple_assign_rhs1 (srcstmt); - bitnum = tree_log2 (gimple_assign_rhs2 (srcstmt)); - } - else - { - op0 = arg0; - bitnum = wi::exact_log2 (nz); - } + int bitnum = wi::exact_log2 (nz); enum tree_code tcode = EQ_EXPR; if ((code == NE) ^ !integer_zerop (arg1)) tcode = NE_EXPR; type = lang_hooks.types.type_for_mode (mode, unsignedp); return expand_single_bit_test (loc, tcode, - op0, + arg0, bitnum, type, target, mode); } } + if (! get_subtarget (target) || GET_MODE (subtarget) != operand_mode) subtarget = 0; From patchwork Mon Jun 5 05:53:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 103087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2473688vqr; Sun, 4 Jun 2023 22:54:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4iZsw1trKjyqy/Toe8OU+joLaBokg1nu8QWwEvw5AvUqEeHXw4uR+5UeS3t26G7iAMmXPG X-Received: by 2002:a05:6402:4308:b0:514:5595:69b3 with SMTP id m8-20020a056402430800b00514559569b3mr8363248edc.4.1685944491657; Sun, 04 Jun 2023 22:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685944491; cv=none; d=google.com; s=arc-20160816; b=imkSqk840RDaGAHNa1ulskbohaGqc1S4EIWlBwaay//prqu4gYqnz1nmfqWgalkPGb 1SsOhF914TnhYZ/hc2o+Ivg7wB4q9yfehcK9J2+5MrJFbBRkhwIoWvCedjz+3PElcObz zN1faOKRfJS8F6y0o7EqbniLUpjFiKXQbtqjd/N7OnteJYIhZUiblfwDbSBVZAzsOqJN QhzpPKCoUNuvm639HCJtV2AkoPL1UmXBK0goELiGwcyD5XCvbI7dtU9X52qcqi/F1uSe y0NF3UFRL08rvH5h25XwNeYkFRUlLX6k73yi0BbBHldlGvZOMDF3kFPHP+KKeCF5wGkC lUSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=jQZW67Bdolyf5BtA0Uu8TpT5KA6b1Smd1cZCt0riwJM=; b=Vp5nqDZ7gR6iT5/GL+iDA9Y7acPgwO458SQ/3WUHm430aPUtTrsFOIWo79G4xPHEoT Z0tFv+3Wgl53HFlYjHQIynJyzTPkpe/Z17KsLA7hSyhQIi7GksQtgSVxvQO9fwg5RiAK N1ue55GOSV/Y5r+ccCGEuSwnNarY/g5B1REBqUnjsDgRaTAvyIy0iXFuB692n3OArMVs 8Dyz/UpMZ2cHBPERu9vOPG1wWRM9OBgsd/MGIuoUOYpL9UmZ/gXPECQjlA++qQzc3fPJ jzyfQ2Q2/Z3jXnktLM7kwzUBEAxoBIybYkhzJKmJ5iqsGxvpnCTppiap1ci6O7vRPlnc pbEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=JmO8oiq0; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id k11-20020a05640212cb00b00514a417f159si4504671edx.202.2023.06.04.22.54.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jun 2023 22:54:51 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=JmO8oiq0; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 216483856625 for ; Mon, 5 Jun 2023 05:54:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 216483856625 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685944481; bh=jQZW67Bdolyf5BtA0Uu8TpT5KA6b1Smd1cZCt0riwJM=; h=To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=JmO8oiq0ayhNBfbIYt/UUiJpSpjxhd+akfZY/ICaLYr5ULqNMbYp4TH2hXeNiE5l8 SjQ294iTRfPF2VetSw+oFKxJ8i0EL6ddhBff4z8jwaivrcOspuiDS94qTQ2Y9eMW71 uPTpy68CUfMCIsGFMOoIsSPX8ZmVaj7t1/+e5mZU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id AD3E13857C43 for ; Mon, 5 Jun 2023 05:53:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD3E13857C43 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 354KeHLQ015673 for ; Sun, 4 Jun 2023 22:53:56 -0700 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3r02vpda1j-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sun, 04 Jun 2023 22:53:56 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 4 Jun 2023 22:53:55 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sun, 4 Jun 2023 22:53:55 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id 458873F7050; Sun, 4 Jun 2023 22:53:55 -0700 (PDT) To: CC: Andrew Pinski Subject: [PATCH 2/2] Handle const_int in expand_single_bit_test Date: Sun, 4 Jun 2023 22:53:31 -0700 Message-ID: <20230605055331.2864335-2-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230605055331.2864335-1-apinski@marvell.com> References: <20230605055331.2864335-1-apinski@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: EKUe9KRsEwvP_f1Rtbkn16ehX2hlrHW9 X-Proofpoint-ORIG-GUID: EKUe9KRsEwvP_f1Rtbkn16ehX2hlrHW9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-03_08,2023-06-02_02,2023-05-22_02 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Pinski via Gcc-patches From: Andrew Pinski Reply-To: Andrew Pinski Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767840931571106867?= X-GMAIL-MSGID: =?utf-8?q?1767840931571106867?= After expanding directly to rtl instead of creating a tree, we could end up with a const_int which is not ready to be handled by extract_bit_field. So need to the constant folding here instead. OK? bootstrapped and tested on x86_64-linux-gnu with no regressions. PR middle-end/110117 gcc/ChangeLog: * expr.cc (expand_single_bit_test): Handle const_int from expand_expr. gcc/testsuite/ChangeLog: * gcc.dg/pr110117-1.c: New test. * gcc.dg/pr110117-2.c: New test. --- gcc/expr.cc | 10 +++++++--- gcc/testsuite/gcc.dg/pr110117-1.c | 31 +++++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/pr110117-2.c | 7 +++++++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr110117-1.c create mode 100644 gcc/testsuite/gcc.dg/pr110117-2.c diff --git a/gcc/expr.cc b/gcc/expr.cc index ca008cd453e..868d812eb1a 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -12958,12 +12958,16 @@ expand_single_bit_test (location_t loc, enum tree_code code, rtx inner0 = expand_expr (inner, NULL_RTX, VOIDmode, EXPAND_NORMAL); + if (CONST_SCALAR_INT_P (inner0)) + { + wide_int t = rtx_mode_t (inner0, operand_mode); + bool setp = (wi::lrshift(t, bitnum) & 1) != 0; + return (setp ^ (code == EQ_EXPR)) ? const1_rtx : const0_rtx; + } int bitpos = bitnum; - scalar_int_mode imode = as_a (GET_MODE (inner0)); - if (BYTES_BIG_ENDIAN) - bitpos = GET_MODE_BITSIZE (imode) - 1 - bitpos; + bitpos = GET_MODE_BITSIZE (operand_mode) - 1 - bitpos; inner0 = extract_bit_field (inner0, 1, bitpos, 1, target, operand_mode, mode, 0, NULL); diff --git a/gcc/testsuite/gcc.dg/pr110117-1.c b/gcc/testsuite/gcc.dg/pr110117-1.c new file mode 100644 index 00000000000..fd9a9e3268e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr110117-1.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-vrp -fno-tree-ccp -fno-tree-forwprop" } */ +int a, b, d; +unsigned c; +int main() { + char e = -10; + int f = 1, g = 0; + if (a) { + char h = e; + i: + c = ~h - (-g & f || e); + int j = b % c; + g = j % 9; + if (c) { + if (d) + e = 0; + while (!g) + ; + int k = 0; + l: + if (k) + goto i; + } + } + if (e > -10) { + if (g) + f = 0; + goto l; + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr110117-2.c b/gcc/testsuite/gcc.dg/pr110117-2.c new file mode 100644 index 00000000000..2e353258084 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr110117-2.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-tree-dominator-opts -fno-tree-vrp -fno-tree-ccp -fno-tree-forwprop -fno-tree-fre -fno-tree-copy-prop" } */ +int f() +{ + int t = 0; + return (t & 1) != 0; +}