From patchwork Wed May 3 23:11:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 89869 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1667356vqo; Wed, 3 May 2023 16:12:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6R4LTT1PVvfvnkJfzWUiPE2MBKBwUtuvTWdVlzxpewPZUCTE+4OlFXHn9SrDPISXOVvXt1 X-Received: by 2002:a17:907:2ce5:b0:94f:8f37:d54 with SMTP id hz5-20020a1709072ce500b0094f8f370d54mr4971358ejc.44.1683155521624; Wed, 03 May 2023 16:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683155521; cv=none; d=google.com; s=arc-20160816; b=fhrE8tPYuspoFE6mW8ObfXsWGjehVBPXwfxS13mJxmGCSliWUOgeJ3Wc9P0ByGkMbI my/RhgJeJRvM8T9i89B4MT0GVlZ5ExDPMZF5bZ6BKGZxG7Itm9K7WCewKi/Jc0EYGJmW sej3zR6Su7AhZJiu50yePjRKUfFPEU23h0GRLXauL1t/3TCMQVMynD0JBZElbtrQzq8Y EZxiRG3u1iWVI1yBClzVbwF3I3lVZJJsiWeUrNIh1S0ZgciwxhRT+aiwzdi7mkviVS1Q V5mKemRD4awYqcyylxg2nB/bNcAPJR9f+gZlE2wHl5O4n3Hi3jTFbIKJjXckQ9uGlIdm rHIQ== 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=f7F258GWSSLG+llxY5QpEOXDZEPsLAotrDhScO31lNE=; b=CJzjicvAarm4L91GLoLnD85s+yFkRHVVkoTVihxOrUWdoOVtT2ErDygaRBCL6AmhCT gwGg9gmJVcslQftzStxPMW623dCDzkMIj0Vij0enWthk/qZI1uSO09tSTwo7mLBX1LD1 xXdugeGLbB9sknlNojhC0p2o6BtZBjijfrmF7NZtGV0Npd3hMCk3FoDxKL+ArzboZfF3 T+sbvnQPYMpJY4ui9TBmT7oZZ5LcBg5EUInMdcJwtQbx/TWfvbkjZnmP58DlIwaA46r0 NEQ3vitlBVFAETaj3pCkmjiRqDdT46/zfMce17T79HXKUrxoUpeQ5PCNpoiiDpcOArGz Jb0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=NQk2ExNo; 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 sg7-20020a170907a40700b009599f639bf9si25318034ejc.990.2023.05.03.16.12.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 May 2023 16:12:01 -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=NQk2ExNo; 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 829E2385734A for ; Wed, 3 May 2023 23:12:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 829E2385734A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683155520; bh=f7F258GWSSLG+llxY5QpEOXDZEPsLAotrDhScO31lNE=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=NQk2ExNoLb6uR4BASfsexN3zrgdkSdSS5G20Xhfiphfb6xeVmiveDtcPIHniacgyU FbDqHwgvV9Dt3HMb5rxV2+Zo/VT6VZSyk0wUiM/Nq+K9aALjGB4hLJSSYZhJHBmeIs DLT1o6YmQCR7mTbXwGBsWimH8fMOxvBXwJvHwfdA= 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 A06783858D28 for ; Wed, 3 May 2023 23:11:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A06783858D28 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 343Mkn0W012371 for ; Wed, 3 May 2023 16:11:14 -0700 Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qc0pq82ys-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 03 May 2023 16:11:14 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 3 May 2023 16:11:12 -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; Wed, 3 May 2023 16:11:12 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id 521215B6928; Wed, 3 May 2023 16:11:12 -0700 (PDT) To: CC: Andrew Pinski Subject: [PATCH] PHIOPT: Improve replace_phi_edge_with_variable's dce_ssa_names slightly Date: Wed, 3 May 2023 16:11:03 -0700 Message-ID: <20230503231103.931391-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Proofpoint-GUID: y2Jeej-6GKpil3YMNrThLjGcPk8xbS_t X-Proofpoint-ORIG-GUID: y2Jeej-6GKpil3YMNrThLjGcPk8xbS_t X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-03_14,2023-05-03_01,2023-02-09_01 X-Spam-Status: No, score=-14.5 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_NONE, 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?1764916484264720279?= X-GMAIL-MSGID: =?utf-8?q?1764916484264720279?= When I added the dce_ssa_names argument, I didn't realize bitmap was a pointer so I used the default argument value as auto_bitmap(). But instead we could just use nullptr and check if it was a nullptr before calling simple_dce_from_worklist. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * tree-ssa-phiopt.cc (replace_phi_edge_with_variable): Change the default argument value for dce_ssa_names to nullptr. Check to make sure dce_ssa_names is a non-nullptr before calling simple_dce_from_worklist. --- gcc/tree-ssa-phiopt.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc index 37b98ef3c52..fbc1fd66607 100644 --- a/gcc/tree-ssa-phiopt.cc +++ b/gcc/tree-ssa-phiopt.cc @@ -89,7 +89,7 @@ single_non_singleton_phi_for_edges (gimple_seq seq, edge e0, edge e1) static void replace_phi_edge_with_variable (basic_block cond_block, edge e, gphi *phi, tree new_tree, - bitmap dce_ssa_names = auto_bitmap()) + bitmap dce_ssa_names = nullptr) { basic_block bb = gimple_bb (phi); gimple_stmt_iterator gsi; @@ -164,7 +164,8 @@ replace_phi_edge_with_variable (basic_block cond_block, gimple_cond_make_true (cond); } - simple_dce_from_worklist (dce_ssa_names); + if (dce_ssa_names) + simple_dce_from_worklist (dce_ssa_names); statistics_counter_event (cfun, "Replace PHI with variable", 1);