From patchwork Tue May 24 06:13:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 54327 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 7F2CB3856DFB for ; Tue, 24 May 2022 06:14:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F2CB3856DFB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1653372840; bh=FsBlfAbdEzXp7ECQwxAj4t3EKagwmAfyuLVBjLD55hs=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=WDwjEyAOKpVf0JmJB8KQrDKSIdp+3KtwbbQvHMs1Rs/jeZW4v5hCDT0wzL4WtG+os h/PQ9kKVwnRpVelr049mCSB+BkQUSfMqHKSiI//+yXBOi4UhhK/U3VFdj3HYhnTX1x tre8dtYfcNGyAYbptKOzqB+9Tcl0wIfwUmGmiSHw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 917983856DE8 for ; Tue, 24 May 2022 06:13:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 917983856DE8 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24O5QUsL026313; Tue, 24 May 2022 06:13:30 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g8s7eguh2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 06:13:29 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24O5vwPv007267; Tue, 24 May 2022 06:13:29 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g8s7eguge-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 06:13:29 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24O6CKfk011515; Tue, 24 May 2022 06:13:27 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04ams.nl.ibm.com with ESMTP id 3g6qq9bvmq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 May 2022 06:13:27 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24O6DPtg17367478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 May 2022 06:13:25 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 278C6A404D; Tue, 24 May 2022 06:13:25 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B0844A4053; Tue, 24 May 2022 06:13:23 +0000 (GMT) Received: from [9.197.252.204] (unknown [9.197.252.204]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 24 May 2022 06:13:23 +0000 (GMT) Message-ID: <62b66fb0-a415-0b2a-dbe4-68cf8069e4cb@linux.ibm.com> Date: Tue, 24 May 2022 14:13:21 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: GCC Patches Subject: [PATCH, committed] rs6000: Skip debug insns for union [PR105627] X-TM-AS-GCONF: 00 X-Proofpoint-GUID: beWIZB3O8UIM8tEo4XbNsS8de3lsVRk9 X-Proofpoint-ORIG-GUID: p8HX2L9LrmvrMaDsFrcHef58JpyEPPtN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-24_04,2022-05-23_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 impostorscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205240035 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H2, SCC_5_SHORT_WORD_LINES, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Cc: David Edelsohn , Segher Boessenkool Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, Bootstrapped and regress-tested on powerpc64-linux-gnu P8 and powerpc64le-linux-gnu P8, P9 and P10. Pushed this as r13-720-g149d04ccbb908b3a251485b43faf204752942b9f. --- As PR105627 exposes, pass analyze_swaps should skip debug insn when doing unionfind_union. One debug insn can use several pseudos, if we take debug insn into account, we can union those insns defining them and generate some unexpected unions. Based on the assumption that it's impossible to have one pseudo which is defined by one debug insn but is used by one nondebug insn, we just asserts debug insn never shows up in function union_defs. PR target/105627 gcc/ChangeLog: * config/rs6000/rs6000-p8swap.cc (union_defs): Assert def_insn can't be a debug insn. (union_uses): Skip debug use_insn. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr105627.c: New test. --- gcc/config/rs6000/rs6000-p8swap.cc | 10 ++++---- gcc/testsuite/gcc.target/powerpc/pr105627.c | 26 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr105627.c -- 2.27.0 diff --git a/gcc/config/rs6000/rs6000-p8swap.cc b/gcc/config/rs6000/rs6000-p8swap.cc index d301bc3fe59..275702fee1b 100644 --- a/gcc/config/rs6000/rs6000-p8swap.cc +++ b/gcc/config/rs6000/rs6000-p8swap.cc @@ -214,8 +214,9 @@ union_defs (swap_web_entry *insn_entry, rtx insn, df_ref use) if (DF_REF_INSN_INFO (link->ref)) { rtx def_insn = DF_REF_INSN (link->ref); - (void)unionfind_union (insn_entry + INSN_UID (insn), - insn_entry + INSN_UID (def_insn)); + gcc_assert (NONDEBUG_INSN_P (def_insn)); + unionfind_union (insn_entry + INSN_UID (insn), + insn_entry + INSN_UID (def_insn)); } link = link->next; @@ -242,8 +243,9 @@ union_uses (swap_web_entry *insn_entry, rtx insn, df_ref def) if (DF_REF_INSN_INFO (link->ref)) { rtx use_insn = DF_REF_INSN (link->ref); - (void)unionfind_union (insn_entry + INSN_UID (insn), - insn_entry + INSN_UID (use_insn)); + if (NONDEBUG_INSN_P (use_insn)) + unionfind_union (insn_entry + INSN_UID (insn), + insn_entry + INSN_UID (use_insn)); } link = link->next; diff --git a/gcc/testsuite/gcc.target/powerpc/pr105627.c b/gcc/testsuite/gcc.target/powerpc/pr105627.c new file mode 100644 index 00000000000..bafb31ff061 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr105627.c @@ -0,0 +1,26 @@ +/* Specify -w to disable some warnings, such as: -Wpsabi. */ +/* { dg-options "-Og -fcompare-debug -mdejagnu-cpu=power8 -w" } */ + +typedef unsigned char __attribute__ ((__vector_size__ (8))) U; +typedef unsigned char __attribute__ ((__vector_size__ (64))) V; + +U u; +char c; +V v; + +V +foo (void) +{ + V w = c + & __builtin_shufflevector (u, (V){0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5}, + 24, 24, 41, 45, 53, 60, 22, 35, 45, 12, 61, + 9, 52, 15, 44, 46, 5, 5, 1, 0, 4, 9, 0, 8, 5, + 7, 2, 5, 9, 2, 7, 7, 5, 6, 0, 2, 6, 1, 7, 7, + 0, 4, 0, 1, 7, 2, 5, 3, 2, 3, 5, 6, 6, 6, 0, + 6, 1, 9, 0, 5, 4, 3, 5, 4); + w = w + v; + return w; +} +