From patchwork Thu Nov 17 17:59:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 60789 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 9D42A3853D43 for ; Thu, 17 Nov 2022 18:00:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D42A3853D43 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668708019; bh=Xkx/YgPpZMES7muhhT7Zi3n+GmVhIMMdQ8AA4dtJ5Ck=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=d31AaL4dTcyoXK9AmX87oQ7iB+5MZwLD/uUl85Ki2ikIcePV/32r5BqUMzGbjVgrf Tmc/Xf8AXzdOnQ7GECpZnXoCDO50F2A8zaMp+YEwX+e8wv7Lygewp/O4XG4TIKDLtf 4CyeQL/GflraCkfraujt/PwKGDuxegBs3UcDgixY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id AEE313854567 for ; Thu, 17 Nov 2022 17:59:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AEE313854567 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AHHbhFv001829 for ; Thu, 17 Nov 2022 09:59:25 -0800 Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3kwg2cadh7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 17 Nov 2022 09:59:25 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 17 Nov 2022 09:59:23 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 17 Nov 2022 09:59:23 -0800 Received: from linux.wrightpinski.org.com (unknown [10.69.242.198]) by maili.marvell.com (Postfix) with ESMTP id 9BEC03F7040; Thu, 17 Nov 2022 09:59:23 -0800 (PST) To: CC: Andrew Pinski Subject: [COMMITTED] Fix PR 107734: valgrind errors with sbitmap in match.pd Date: Thu, 17 Nov 2022 09:59:18 -0800 Message-ID: <1668707958-10346-1-git-send-email-apinski@marvell.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 8I3hkfIG32se4eiXxw3hHrWGA5Eu3r37 X-Proofpoint-GUID: 8I3hkfIG32se4eiXxw3hHrWGA5Eu3r37 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-17_06,2022-11-17_01,2022-06-22_01 X-Spam-Status: No, score=-14.5 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: apinski--- via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: apinski@marvell.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Andrew Pinski sbitmap is a simple bitmap and the memory allocated is not cleared on creation; you have to clear it or set it to all ones before using it. This is unlike bitmap which is a sparse bitmap and the entries are cleared as created. The code added in r13-4044-gdc95e1e9702f2f missed that. This patch fixes that mistake. Committed as obvious after a bootstrap and test on x86_64-linux-gnu. gcc/ChangeLog: PR middle-end/107734 * match.pd (perm + vector op pattern): Clear the sbitmap before use. --- gcc/match.pd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/match.pd b/gcc/match.pd index 5aba1653b80..a4d1386fd9f 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -8288,6 +8288,8 @@ and, if (sel.encoding ().encoded_full_vector_p ()) { auto_sbitmap seen (nelts); + bitmap_clear (seen); + unsigned HOST_WIDE_INT count = 0, i; for (i = 0; i < nelts; i++)