From patchwork Wed Oct 30 00:55:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 99800 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 55C723858401 for ; Wed, 30 Oct 2024 00:56:20 +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 3B0633858C98 for ; Wed, 30 Oct 2024 00:55:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3B0633858C98 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 3B0633858C98 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=1730249745; cv=none; b=aQ4MxahG16s6yZ+N2Hbkk0uwGYlRD1IeTWN3lbwFmS85nWI+fNH0I1lCjPPrbEDcFOtPy7Baa3ATO4LhV4MY14prIBMnVW/54QUMD23BSU9T185xZldGpJqY5KfpJ+HG+TJe4gT8wx+PQm9HzwJCBVt3eHAdjqvvk2ksSgLjgqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730249745; c=relaxed/simple; bh=x4jYaOZjNrUKRUHOUr8R1faZh3Dq8VxnsYvO83UI0Ws=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=x+h50KoqCKcmP0CYuVPqE1wA7qgq3xD29PRYV9OMGY3yB7OEZRtDG70p9YfM0iyqUCjMvjpSYChS0EMDg5/LpnRKGRHDrtUotkM37l62Cw3w0nIgnHNRyTfcEUPvFdfA2S8jcPmpuZiRue6qhhkJaa+UCFLUn7Oj+2GZp1eLaZA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49TMAt30011869 for ; Wed, 30 Oct 2024 00:55:42 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=voQ4uy58dnj+GPL4O3SY7d 1IRbW8gow0ESbMqAAP6Ps=; b=B8h0HW7kBKE9juPCWfm2qUTQtSlVdNL9XP8QP7 I2wvd6Nc+3wpjq0QocIF9td31YhPnA3uJaUhJrkaP3Bt+Mo+X3XBYUbCk/i/ziye LFcZ3qPK7DGdUVIpXQ0j0t4AyY1B3bNfKasrKoNI9EqFJAoX4JCN9CB0xyIsQAV8 DMZ1Hr4pl3WE8Mf/iZ7WrYP6zyTIaSEntopMlfomp0GmvgGPf+Xt57BrYUJFkOZY b54vmfWFt4ee6VCiqn9tY+KPYL8kg67IukXUQO3fFNq1qGsDU67MUBr3exy12yjm 8XkTveV4zucudeHp/2qqbJ6qiYHJDwb1NliojKeZhyN4usgQ== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 42gqcqt86x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 30 Oct 2024 00:55:41 +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 49U0tfJB027820 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 30 Oct 2024 00:55:41 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; Tue, 29 Oct 2024 17:55:41 -0700 From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH] gimple: Remove special handling of COND_EXPR for COMPARISON_CLASS_P [PR116949, PR114785] Date: Tue, 29 Oct 2024 17:55:29 -0700 Message-ID: <20241030005529.1350337-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: nalasex01b.na.qualcomm.com (10.47.209.197) 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: ZZlftiXVTkOEbArPtj_GGbAi7mTVsKhE X-Proofpoint-GUID: ZZlftiXVTkOEbArPtj_GGbAi7mTVsKhE 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 lowpriorityscore=0 malwarescore=0 suspectscore=0 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410300006 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~patchwork=sourceware.org@gcc.gnu.org After r13-707-g68e0063397ba82, COND_EXPR for gimple assign no longer could contain a comparison. The vectorizer was builting gimple assigns with comparison until r15-4695-gd17e672ce82e69 (which added an assert to make sure it no longer builds it). So let's remove the special handling COND_EXPR in a few places and add an assert to gimple_build_assign_1 to make sure we don't build a gimple assign any more with a comparison. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: PR middle-end/114785 PR middle-end/116949 * gimple-match-exports.cc (maybe_push_res_to_seq): Remove special handling of COMPARISON_CLASS_P in COND_EXPR/VEC_COND_EXPR. (gimple_extract): Likewise. * gimple-walk.cc (walk_stmt_load_store_addr_ops): Likewise. * gimple.cc (gimple_build_assign_1): Signed-off-by: Andrew Pinski --- gcc/gimple-match-exports.cc | 12 +----------- gcc/gimple-walk.cc | 11 ----------- gcc/gimple.cc | 3 +++ 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/gcc/gimple-match-exports.cc b/gcc/gimple-match-exports.cc index 77d225825cf..bc8038c19f0 100644 --- a/gcc/gimple-match-exports.cc +++ b/gcc/gimple-match-exports.cc @@ -489,12 +489,6 @@ maybe_push_res_to_seq (gimple_match_op *res_op, gimple_seq *seq, tree res) && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[i])) return NULL_TREE; - if (num_ops > 0 && COMPARISON_CLASS_P (ops[0])) - for (unsigned int i = 0; i < 2; ++i) - if (TREE_CODE (TREE_OPERAND (ops[0], i)) == SSA_NAME - && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (ops[0], i))) - return NULL_TREE; - if (res_op->code.is_tree_code ()) { auto code = tree_code (res_op->code); @@ -786,11 +780,7 @@ gimple_extract (gimple *stmt, gimple_match_op *res_op, } case GIMPLE_TERNARY_RHS: { - tree rhs1 = gimple_assign_rhs1 (stmt); - if (code == COND_EXPR && COMPARISON_CLASS_P (rhs1)) - rhs1 = valueize_condition (rhs1); - else - rhs1 = valueize_op (rhs1); + tree rhs1 = valueize_op (gimple_assign_rhs1 (stmt)); tree rhs2 = valueize_op (gimple_assign_rhs2 (stmt)); tree rhs3 = valueize_op (gimple_assign_rhs3 (stmt)); res_op->set_op (code, type, rhs1, rhs2, rhs3); diff --git a/gcc/gimple-walk.cc b/gcc/gimple-walk.cc index 9f768ca20fd..00520319aa9 100644 --- a/gcc/gimple-walk.cc +++ b/gcc/gimple-walk.cc @@ -835,17 +835,6 @@ walk_stmt_load_store_addr_ops (gimple *stmt, void *data, ; else if (TREE_CODE (op) == ADDR_EXPR) ret |= visit_addr (stmt, TREE_OPERAND (op, 0), op, data); - /* COND_EXPR and VCOND_EXPR rhs1 argument is a comparison - tree with two operands. */ - else if (i == 1 && COMPARISON_CLASS_P (op)) - { - if (TREE_CODE (TREE_OPERAND (op, 0)) == ADDR_EXPR) - ret |= visit_addr (stmt, TREE_OPERAND (TREE_OPERAND (op, 0), - 0), op, data); - if (TREE_CODE (TREE_OPERAND (op, 1)) == ADDR_EXPR) - ret |= visit_addr (stmt, TREE_OPERAND (TREE_OPERAND (op, 1), - 0), op, data); - } } } else if (gcall *call_stmt = dyn_cast (stmt)) diff --git a/gcc/gimple.cc b/gcc/gimple.cc index eeb1badff5f..f7b313be40e 100644 --- a/gcc/gimple.cc +++ b/gcc/gimple.cc @@ -475,6 +475,9 @@ gimple_build_assign_1 (tree lhs, enum tree_code subcode, tree op1, gimple_build_with_ops_stat (GIMPLE_ASSIGN, (unsigned)subcode, num_ops PASS_MEM_STAT)); gimple_assign_set_lhs (p, lhs); + /* For COND_EXPR, op1 should not be a comparison. */ + if (op1 && subcode == COND_EXPR) + gcc_assert (!COMPARISON_CLASS_P (op1)); gimple_assign_set_rhs1 (p, op1); if (op2) {