From patchwork Sat Oct 12 22:07:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1996438 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=RNAY9GsN; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4XQyKV4FWBz1xv6 for ; Sun, 13 Oct 2024 09:07:40 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C5AF83858414 for ; Sat, 12 Oct 2024 22:07:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id 9251D3858D3C for ; Sat, 12 Oct 2024 22:07:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9251D3858D3C 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 9251D3858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728770840; cv=none; b=HioefgGSqw5l6QXsCi9EUjOtBu5H0ooPtl0qX7pPnXHhlL2O7HVNxFlL9K/5IDEbU/snfWmOZKHicotf1/PII1ZdT96755zh2uspIk0+x33Gsm8WBbVLbgSG/ZHc+el2mu+1Ya6ycakqnBrPQ93M1lH6DVlXt/TtbSCDdTjPIYc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728770840; c=relaxed/simple; bh=9lQIU4zDPbIAZnMzq6HiwVVI2wZw5ZdSa89Pkt2oSLE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=K4eTfK1e9H01IjKmf/60Yf0Oe+WOiTXCbIrvz6Lyvps4Sn0dOMIX2SM2z23KtKLGSNBHrCfppx/6uKUJ2sLuzSxp4pLN7IEh8ZEgVuE2liTwLbOUo29bIASD4pldc2tTgpUURAcZFKnxevNj7miybrbUcsnqk77N/paYsuViK48= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49CLn5OQ016746 for ; Sat, 12 Oct 2024 22:07:17 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=wogg9wumVoQVVnJutcZA+C Srn6XUwULeb54bXCtqc28=; b=RNAY9GsN/c9YinsqT5gmxibbX6/6MUiqH/47Z8 rtaJCesKaGg34ynQY0GcCaXYw6Ah3G8DAJEqPDR2Jzh7NQ3Tmmn5HHijkmecwsXf Ogrv+hhbpmao+xVbAUegA2D+LXVYTunNVCcVJ/Amwfr3YiNZXMfy7ytoyun+qrpq b4wAjK3nmBFbDPDB71KV1V5om9BGwSock7CnFrsu8CLBDuUn6sGHhIYWSlRryGPD se3eG4t4QAlQsQLGrrp2+r5GV7FQLhlNPcN3H2dQ8vPhHKXm9ua9peh6GHdluCz7 YZgGm/9t3iq+rJ4M0ZtD00eLblw1OLvMyjxCh+ANYWAR4NhA== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 427j9ks4rk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 12 Oct 2024 22:07:17 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 49CM7GwF016854 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 12 Oct 2024 22:07:16 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) 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; Sat, 12 Oct 2024 15:07:16 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH] DSE: add remove_unused_locals to the todos [PR117096] Date: Sat, 12 Oct 2024 15:07:04 -0700 Message-ID: <20241012220704.372504-1-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) 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-GUID: Hx4NK12p9aE2kYS5jf6o_NX6zHMy0gyB X-Proofpoint-ORIG-GUID: Hx4NK12p9aE2kYS5jf6o_NX6zHMy0gyB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 clxscore=1015 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410120164 X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, 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 This is a better patch to fix PR 117096 (phiopt vs clobbers). The only time we remove clobbers of local variables is during remove_unused_locals. Since DSE might remove all of the stores to a local variable, it makes sense to also try to remove unused local variables afterwards. This shows up more in C++ code with encapsulation. This was previously mentioned to be done: https://gcc.gnu.org/pipermail/gcc-patches/2021-April/567744.html In the end it was chosen "Or we might want to place explicit schedules of remove_unused_locals in the pass pipeline." (in stdargs, https://gcc.gnu.org/pipermail/gcc-patches/2021-April/568807.html) but that is too late for early phiopt. This patch does the "maybe we should unconditionally do so" option instead. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: PR tree-optimization/117096 * tree-ssa-dse.cc (pass_data_dse): Add TODO_remove_unused_locals to todo_flags_finish. Signed-off-by: Andrew Pinski --- gcc/tree-ssa-dse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-ssa-dse.cc b/gcc/tree-ssa-dse.cc index 63bf4491cf6..42a133b8631 100644 --- a/gcc/tree-ssa-dse.cc +++ b/gcc/tree-ssa-dse.cc @@ -1654,7 +1654,7 @@ const pass_data pass_data_dse = 0, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ + TODO_remove_unused_locals, /* todo_flags_finish */ }; class pass_dse : public gimple_opt_pass