From patchwork Sun Oct 27 23:41:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 2003033 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=OhW03Epj; 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 4XcCjl4N07z1xwc for ; Mon, 28 Oct 2024 10:42:19 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C49E53858D20 for ; Sun, 27 Oct 2024 23:42:16 +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 58B663858403 for ; Sun, 27 Oct 2024 23:41:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 58B663858403 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 58B663858403 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=1730072516; cv=none; b=qIadMA+hMPV+Jd0w0O1CqBYpVU0n17Ai09OLZW71brfPPl1o8vn0937hpnaxJzGqie2qkhQ8IfxhBKodSUtw4o/hzNQxYQnx5eUwdZ000hdw1ztkzo3QjZsd3Rzy50EZHdtNymKiJUd9VUGtF899nvToWOppXSgLbTTXf7zEZuc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730072516; c=relaxed/simple; bh=w2vCH3eXMZy2eio5JrKVwsYg+QyCu3cRSY32JGSD4yY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=JJFMoyKc1WuVG4JsOOu1YGm4rhUS1GsWRHSn553i5aH+bt2nVGd8R/GIKRJt+n1qoLBMgLwTPHYIssovdm/A9zBHqRt2jdK+AseuXv4qxh/gM8ToFmkR9MhUTXdXIIZvhizpWtG7X32ZZKCU6txLVAYxRHVSyIayJBHysxITfFU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49RMkUNN025437 for ; Sun, 27 Oct 2024 23:41:52 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=lrG3tHiHBBYn8BIzR7Zi0o 8lIyPQmh6fMBSRPwBx6Xk=; b=OhW03EpjCmWyrrtkgjp2P1mHBqQEPQzGiXHVYr O52VS4hK6p6Dn2lelHqih5dUKcMYOdmyunebNeX3VTtmnNtNtImMKh5SOeqlXe4T 7lpCQfbZbNG/tlWM6wY0DC36zdbjVjCBQNCGgxsILXQnxLbK1DkFnXQysgzzoNOv b045Zk/ko93726OgpgwrtNtrZnnRtNzBk6xPi6cSblAnqQIDOaNn7GS8gW9eZfjE BeeHZTXsyKOwMxvQC7j4DgED9FKqCB1vvOnl8hCVQhskevm9O53Xf9Uz/Rrn95LD jN4ToJBQf6EPrDPNB9ZFQr1gdqxsTs3ac7b5UcRcJoyjoAcw== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 42gsq8b43m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 27 Oct 2024 23:41:52 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 49RNfpqW010655 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 27 Oct 2024 23:41:51 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; Sun, 27 Oct 2024 16:41:51 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH] phiopt: Move check for maybe_undef_p slightly earlier Date: Sun, 27 Oct 2024 16:41:42 -0700 Message-ID: <20241027234142.218355-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: nalasex01a.na.qualcomm.com (10.47.209.196) 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: qPEQNWY_WBvpJ2jXW42q7Q7kodrz9tKn X-Proofpoint-ORIG-GUID: qPEQNWY_WBvpJ2jXW42q7Q7kodrz9tKn 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 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 priorityscore=1501 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410270209 X-Spam-Status: No, score=-14.1 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 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 moves the check for maybe_undef_p in match_simplify_replacement slightly earlier before figuring out the true/false arg using arg0/arg1 instead. In most cases this is no difference in compile time; just in the case there is an undef in the args there would be a slight compile time improvement as there is no reason to figure out which arg corresponds to the true/false side of the conditional. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-ssa-phiopt.cc (match_simplify_replacement): Move check for maybe_undef_p earlier. Signed-off-by: Andrew Pinski --- gcc/tree-ssa-phiopt.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc index f8b119ea836..cffafe101a4 100644 --- a/gcc/tree-ssa-phiopt.cc +++ b/gcc/tree-ssa-phiopt.cc @@ -943,6 +943,13 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb, stmt_to_move_alt)) return false; + /* Do not make conditional undefs unconditional. */ + if ((TREE_CODE (arg0) == SSA_NAME + && ssa_name_maybe_undef_p (arg0)) + || (TREE_CODE (arg1) == SSA_NAME + && ssa_name_maybe_undef_p (arg1))) + return false; + /* At this point we know we have a GIMPLE_COND with two successors. One successor is BB, the other successor is an empty block which falls through into BB. @@ -982,13 +989,6 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb, arg_false = arg0; } - /* Do not make conditional undefs unconditional. */ - if ((TREE_CODE (arg_true) == SSA_NAME - && ssa_name_maybe_undef_p (arg_true)) - || (TREE_CODE (arg_false) == SSA_NAME - && ssa_name_maybe_undef_p (arg_false))) - return false; - tree type = TREE_TYPE (gimple_phi_result (phi)); { auto_flow_sensitive s1(stmt_to_move);