From patchwork Fri Mar 12 16:54:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schulze Frielinghaus X-Patchwork-Id: 1452223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=kqRdiMxI; dkim-atps=neutral Received: from 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DxsQB6z0vz9sR4 for ; Sat, 13 Mar 2021 03:55:45 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 40B2B396E840; Fri, 12 Mar 2021 16:55:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40B2B396E840 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1615568143; bh=S+Q3yxfKVRBEPr9cLyGqmrKyro4pspeLdII5hMB5ReI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=kqRdiMxIBH6wgTKwdVHlR9OYFQjnehm1Gg51yI7hvgPPE294C4fkXFgn8z8dhe6dd GS7u4DCKpq9HKDE+pBbUoWYbCR0WWG/lPFsgSQ7pGSA7xiA6nQc5QNcVVmu4zJklUF YsTxAcS8bN5YZPMeHiq4FUQWtRZfy8qF3uLPs28Y= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 1BDA7396E840 for ; Fri, 12 Mar 2021 16:55:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1BDA7396E840 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12CGY7Tk167867 for ; Fri, 12 Mar 2021 11:55:38 -0500 Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 378agf32ya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Mar 2021 11:55:38 -0500 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12CGqltC029945 for ; Fri, 12 Mar 2021 16:55:36 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06fra.de.ibm.com with ESMTP id 3768n61mtw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Mar 2021 16:55:36 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12CGtYcr47186342 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 12 Mar 2021 16:55:34 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1E489AE04D for ; Fri, 12 Mar 2021 16:55:34 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02BEAAE057 for ; Fri, 12 Mar 2021 16:55:34 +0000 (GMT) Received: from t35lp57.lnxne.boe (unknown [9.152.108.100]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS for ; Fri, 12 Mar 2021 16:55:33 +0000 (GMT) To: gcc-patches@gcc.gnu.org Subject: [PATCH] cprop_hardreg: Ensure replacement reg has compatible mode [PR99221] Date: Fri, 12 Mar 2021 17:54:22 +0100 Message-Id: <20210312165421.3379003-1-stefansf@linux.ibm.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-12_06:2021-03-12, 2021-03-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=859 clxscore=1015 malwarescore=0 impostorscore=0 mlxscore=0 adultscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103120119 X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Stefan Schulze Frielinghaus via Gcc-patches From: Stefan Schulze Frielinghaus Reply-To: Stefan Schulze Frielinghaus Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" In addition to the existing check also ask the target whether a replacement register may be accessed in a different mode than it was set before. Bootstrapped and regtested on IBM Z. Ok for mainline? gcc/ChangeLog: * regcprop.c (find_oldest_value_reg): Ask target whether different mode is fine for replacement register. --- gcc/regcprop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/regcprop.c b/gcc/regcprop.c index e1342f56bd1..02753a12510 100644 --- a/gcc/regcprop.c +++ b/gcc/regcprop.c @@ -474,7 +474,8 @@ find_oldest_value_reg (enum reg_class cl, rtx reg, struct value_data *vd) (set (...) (reg:DI r9)) Replacing r9 with r11 is invalid. */ if (mode != vd->e[regno].mode - && REG_NREGS (reg) > hard_regno_nregs (regno, vd->e[regno].mode)) + && (REG_NREGS (reg) > hard_regno_nregs (regno, vd->e[regno].mode) + || !REG_CAN_CHANGE_MODE_P (regno, mode, vd->e[regno].mode))) return NULL_RTX; for (i = vd->e[regno].oldest_regno; i != regno; i = vd->e[i].next_regno)