From patchwork Tue Jul 16 22:34:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1961344 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=TynraffH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WNv6j1VBdz1xrQ for ; Wed, 17 Jul 2024 08:35:55 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0BC4A384A056 for ; Tue, 16 Jul 2024 22:35:54 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id CCA4C3858C56 for ; Tue, 16 Jul 2024 22:35:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CCA4C3858C56 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CCA4C3858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721169335; cv=none; b=dZnWxKWfvcpceyxOzlZd3IHHPzK09hXGD64JyPHk34Wxff+nYEw4knxcFYhiYDbsuCOqxxr/qBQlDrbiHzT2wSet83eRC57GXnLWEnm9dKBj0cwbhol6zuvIHDLHVFApuekr94zw5oDGGbvFoP6Ew/7mwNr6vk9+45m+MJ+alA8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721169335; c=relaxed/simple; bh=oj2YiKCNUs6Bv6abtYLbfgqPwg0qf1m8qshyvRWCqU0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=VnYt7gQpyk0ROBtgGgJdfCpIUgFHuh/kerl7oKW02RJJcAZFzi6f/WGsZO/EjJRiJEHJNkqLp1qUzxq7XtVMnytWrmXbEim95mLt72RgS9rcbXgx1HJeFzKjZPI/OXKwIyop7/hBztAIpLXynztS3O3B1xJC4skjAqv1sZPXa5Q= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46GHfBdW008355 for ; Tue, 16 Jul 2024 22:35:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=KY/61hHgjzMB0u9RWoW6ck yPf5Vl/xBoukPaSmoYl9g=; b=TynraffH3C6aVqt4S6weG7xyQRb5LVGZrRFxtF rIR1RIykd/i3k9m+YaeDCtAvoDmVKhF8UYLWOth9LCQqotzyAjLYHolp3RheK27O nSLZZ4x7GDgs130mT5PixuVNhmB4KxYYSOp7msC/akyTZMMNlSEri/WmDr3clA+l Y7PyDhJiRQzt8DN9+GRUCufYaxFC8BZt2GVhU/QmXtaOcipmfWQQwzZsy283veEv Pzk0vHNDQNri3ZHKqoIZEUx9Y+vshJvZRPYzCM2Ok99//5DXBc0aqxwdgUR/ytZ7 j1xuTbgQ4TTpiHHAf/MkOP5aOTcJoHWK4A58wvG0wQKT1ynA== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40dwfu0gpp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 16 Jul 2024 22:35:32 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA03.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 46GMZBlD025081 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 16 Jul 2024 22:35:11 GMT Received: from hu-apinski-lv.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Tue, 16 Jul 2024 15:35:11 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH] Add debug counter for ext_dce Date: Tue, 16 Jul 2024 15:34:59 -0700 Message-ID: <20240716223459.3323793-1-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: p7l6HT70yHd_bMNc3IHVROiQ7LgWoErp X-Proofpoint-GUID: p7l6HT70yHd_bMNc3IHVROiQ7LgWoErp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-16_02,2024-07-16_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 bulkscore=0 impostorscore=0 mlxscore=0 mlxlogscore=751 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2407160166 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Like r15-1610-gb6215065a5b143 (which adds one for late_combine), adding one for ext_dce is useful to debug some issues with this pass. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * dbgcnt.def (ext_dce): New debug counter. * ext-dce.cc (ext_dce_try_optimize_insn): Reject the insn if the debug counter says so. Signed-off-by: Andrew Pinski --- gcc/dbgcnt.def | 1 + gcc/ext-dce.cc | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def index e0b9b1b2a76..ac1f8709849 100644 --- a/gcc/dbgcnt.def +++ b/gcc/dbgcnt.def @@ -162,6 +162,7 @@ DEBUG_COUNTER (dom_unreachable_edges) DEBUG_COUNTER (dse) DEBUG_COUNTER (dse1) DEBUG_COUNTER (dse2) +DEBUG_COUNTER (ext_dce) DEBUG_COUNTER (form_fma) DEBUG_COUNTER (gcse2_delete) DEBUG_COUNTER (gimple_unroll) diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc index 6c961feee63..6d4b8858ec6 100644 --- a/gcc/ext-dce.cc +++ b/gcc/ext-dce.cc @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see #include "rtl-iter.h" #include "df.h" #include "print-rtl.h" +#include "dbgcnt.h" /* These should probably move into a C++ class. */ static vec livein; @@ -312,6 +313,15 @@ ext_dce_try_optimize_insn (rtx_insn *insn, rtx set) print_rtl_single (dump_file, SET_SRC (set)); } + /* We decided to turn do the optimization but allow it to be rejected for + bisection purposes. */ + if (!dbg_cnt (::ext_dce)) + { + if (dump_file) + fprintf (dump_file, "Rejected due to debug counter.\n"); + return; + } + new_pattern = simplify_gen_subreg (GET_MODE (src), inner, GET_MODE (inner), 0); /* simplify_gen_subreg may fail in which case NEW_PATTERN will be NULL. @@ -881,8 +891,8 @@ static bool ext_dce_rd_confluence_n (edge) { return true; } are never read. Turn such extensions into SUBREGs instead which can often be propagated away. */ -static void -ext_dce (void) +void +ext_dce_execute (void) { df_analyze (); ext_dce_init (); @@ -929,7 +939,7 @@ public: virtual bool gate (function *) { return flag_ext_dce && optimize > 0; } virtual unsigned int execute (function *) { - ext_dce (); + ext_dce_execute (); return 0; }