From patchwork Sun Dec 10 09:21:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andrew Pinski (QUIC)" X-Patchwork-Id: 176315 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6433391vqy; Sun, 10 Dec 2023 01:21:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGfdRyNcyCkR2t5fytDKsulDJs1W9xh0WlUeEmnsyjauBCsN3zxU6YqDtofZK6W2E1ceaO/ X-Received: by 2002:a05:6214:2685:b0:67a:a72d:fbb3 with SMTP id gm5-20020a056214268500b0067aa72dfbb3mr4686845qvb.49.1702200119754; Sun, 10 Dec 2023 01:21:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702200119; cv=pass; d=google.com; s=arc-20160816; b=hGkMPyZfc2dRUMHHUdTXEubOSS3U2LlbThMU2LhjFKg4gApaGCjCxxqJ5JDXsRYEp3 BqVhoITDCIt7073YyyAUyEukh0j8pZisne14t+WU9GI1FP/sTdjHd2CNcD9q/zh5Ab9e FjfCEUCIFAhfvxJOe86SCD7xUxZXC1Gp4FKVci2wqsOfAcvo/es+edXzfhQ63/GrmHbb URRH8Tt3v8wOxd8gH6eYZPExuuu/IvPM+jl92pEpxeW0yQTi8kHeTI1E8x5H9Ef506bn Yh1Vzn9OZUR2vgF7iry2aVqaTqG4nR2K8bfDaaO+67OvHsYj7X4kSr/A30v3fd3k0G3l WhCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=gh/9ka+Y2os/cGUnr0ZcIJzRdjsU0wmzMu1mQhtgKpE=; fh=gk9A5O7Gbglvz1MjrRQ4hZ2i3c68kYkpOZJg1emXh+g=; b=oiMtOw4JLw9DNN+HuAsCY/ttNoTb4UQsMsg7jfr+9g4J697MxE4mPzDWu+L9UNan/D qjfkRziRzuA2PG0t4mrD/ur8z6in9oiBgXInhBzJWDeNdX54YxyuzS6OlHeLHf2CcgAy +llVQXxv553EAHv7UIJJooHvp9cxkrhVVzbo/BijldMfm/YqX42p7CZuJn6AeEzdpcsU vgsXgQiyj5hJI+EBsmWIM4W9Pkzj5FxQyAs0LouEpLx72rT17QXFlEDdPn7W+DjLkOO2 FkSyXE76AFWdHf+7Jx2aaQ9El+wYwpvo6rs9k5X5UCh8SRLgChJJTiDkuhtCDLxql4QS +D3g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=NHtXLRuK; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c16-20020a0ca9d0000000b00679df308ffesi5963752qvb.332.2023.12.10.01.21.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 01:21:59 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=NHtXLRuK; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 84DE13858286 for ; Sun, 10 Dec 2023 09:21:59 +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 F342C3858D33 for ; Sun, 10 Dec 2023 09:21:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F342C3858D33 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 F342C3858D33 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=1702200097; cv=none; b=AyWhP5mpTHlEzlUSy9vxU/T9EdPh1lEmP+mvnyBUTmBbLmsKcDpV9mIu9AGVO1pAoNKV9KRtXODvhLUFDCiv7HKwI61eb5VwdWVGJL/nnjPlwHtHiwU8VBS9l8ocUyTaIWEwaCQVa2t4FkCVn7nIX3yKQlOVl0Sv8EQ68VVhK/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702200097; c=relaxed/simple; bh=GdyPH1abS6ChIhsu6muN6L7UXHHrdcP1QCGJ3c557QA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qAiHBc4POMn9bDi57NLdEVZ54rtVaYb55Lqn3i154qOBwvCjK5cwuBtYJcYJh20eOR3OE7HCUUbhC3wOBVWjWk4UAmCmdLj7ruyB2+5Oh7ax7TzLK99HgdJOEH1pzK++pdDg+WYe86AC7UriaZ84mbdpdXwMajL0+s+Dz8k+sck= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BA9IWxb005899 for ; Sun, 10 Dec 2023 09:21:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=qcppdkim1; bh=gh/9ka+ Y2os/cGUnr0ZcIJzRdjsU0wmzMu1mQhtgKpE=; b=NHtXLRuKIrOr7ZtgGGmQZLe Q9BFLQv3ms/lr4C1U56RR9IFcB9i9KO9M+Wh7Kfgt+qnMY0rFzJV1ivCReAxwkbE cTt4K0gkO0AsJqXskgzIvx7mVbhYSUXvBxvTTJerrA3otVBT57ijcKCvL18yn4M0 d6M9o/WQkJ9WKxkFYPslt72mSb2qpprPQlRCeMrgR8fxbWyOFLNQmzlS9PGJCNJC 59q/1x4wNypstCLX9BRYECZUebpOmWETmx8LH3PumnIv3nnB9RJoV/VoHVh7OPvZ rWQHwPhjDtrWUyxIZbAy1mp9lkXB0EwKA9NRdV+N8HRdwqfa9QDkS/MMPlh4NXw= = Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uvnnss59t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 10 Dec 2023 09:21:35 +0000 (GMT) Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BA9LYUM021072 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 10 Dec 2023 09:21:34 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.1118.40; Sun, 10 Dec 2023 01:21:34 -0800 From: Andrew Pinski To: Subject: [PATCH] expr: catch more `a*bool` while expanding [PR 112935] Date: Sun, 10 Dec 2023 01:21:25 -0800 Message-ID: <20231210092125.1535761-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-ORIG-GUID: IeBegUUhshtkIQJZ1oEE0cnGPGQCx4Jp X-Proofpoint-GUID: IeBegUUhshtkIQJZ1oEE0cnGPGQCx4Jp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 spamscore=0 priorityscore=1501 adultscore=0 malwarescore=0 mlxlogscore=585 clxscore=1015 mlxscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312100080 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784886192712389795 X-GMAIL-MSGID: 1784886192712389795 After r14-1655-g52c92fb3f40050 (and the other commits which touch zero_one_valued_p), we end up with a with `bool * a` but where the bool is an SSA name that might not have non-zero bits set on it (to 0x1) even though it does the non-zero bits would be 0x1. The case of coremarks, it is only phiopt4 which adds the new ssa name and nothing afterwards updates the nonzero bits on it. This fixes the regression by using gimple_zero_one_valued_p rather than tree_nonzero_bits to match the cases where the SSA_NAME didn't have the non-zero bits set. gimple_zero_one_valued_p handles one level of cast and also and an `&`. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: PR middle-end/112935 * expr.cc (expand_expr_real_2): Use gimple_zero_one_valued_p instead of tree_nonzero_bits to find boolean defined expressions. Signed-off-by: Andrew Pinski --- gcc/expr.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/expr.cc b/gcc/expr.cc index 6da51f2aca2..4686cacd22f 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -10209,8 +10209,9 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, /* Expand X*Y as X&-Y when Y must be zero or one. */ if (SCALAR_INT_MODE_P (mode)) { - bool bit0_p = tree_nonzero_bits (treeop0) == 1; - bool bit1_p = tree_nonzero_bits (treeop1) == 1; + bool gimple_zero_one_valued_p (tree, tree (*)(tree)); + bool bit0_p = gimple_zero_one_valued_p (treeop0, nullptr); + bool bit1_p = gimple_zero_one_valued_p (treeop1, nullptr); /* Expand X*Y as X&Y when both X and Y must be zero or one. */ if (bit0_p && bit1_p)