From patchwork Thu Sep 22 01:41:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1353 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp2218112wrt; Wed, 21 Sep 2022 18:43:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wQfucPslcro2v7/eGZucHrZ7+k/U1F8jYt3s8JX51hLxkjx3GePA79U7bvvzY+Plmug0w X-Received: by 2002:a17:907:2bef:b0:77d:e0f3:81e6 with SMTP id gv47-20020a1709072bef00b0077de0f381e6mr835461ejc.513.1663811009610; Wed, 21 Sep 2022 18:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663811009; cv=none; d=google.com; s=arc-20160816; b=r50g3hs5RZ6gai6r/yJLZ/6UNjdscjCbkc/I7jUz1nuxHgK4sdT7PXCaX8JfuLyfpG 7JZmUqB+lmpD10nfjueqQTXgEMoxFwyD25jVTtJaaGvYLN+DI+ydTbARGBOKdEE3xmBI UDykuJhTe8oSHv9zZcoYZSctNg7XP+I5H4mbAqPNaM8Z9moTeP0FfaaEDY22Wi+zs5AP btBH0iG39755US++F8itcjVFHDfv898SrNUJjjBYm67llG0piNUszpFoGWlnsy0w6VYA pPPGusp1mTAh5RFENVvqzFuwFBgcHWMCFjJmZ9gU9FPHMjzNZ1Q5BIRLPNHYBXgM8786 a3gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:subject:to:content-language:user-agent :mime-version:date:message-id:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=uDGUVMsvwVm5/sJoQpp24SKfifRtn1jK3/eLqLGTc7w=; b=WHQsskvRekCN6ds26F6+06Mr0nC6dX3LqP8LV+zHCEDWAnrf/rtpPnxjjcr1xLPHFc 4wqj6VfheqDrjx//siyKAJTB2pnB126YCiOkRNI7BV3tBzJ2khWcDq1NmXn5IHJe9nSd I01KDbQsKqGIqEKW/pFNBanqQ5UFQoU2jlOa4/eCL1X1DX5tm8UNBr70U9fcWW7X2eVL fx6t5mi9//y3kGGLqpQfuY2eURr3A6hhvv+fNDNSihjmDUswhYdAd5vabqMvWukiEcVU fxG0YZqeLzq4WiZhsLPtRiPobG1PScqU4590ckwfi/rpVQSZmNYphSSn3OfzBGVW0tTR eQtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="t8/mhBn5"; 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=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hc15-20020a170907168f00b007823f12eaecsi1532969ejc.332.2022.09.21.18.43.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 18:43:29 -0700 (PDT) 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=@gcc.gnu.org header.s=default header.b="t8/mhBn5"; 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=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 205D33858418 for ; Thu, 22 Sep 2022 01:43:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 205D33858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663811007; bh=uDGUVMsvwVm5/sJoQpp24SKfifRtn1jK3/eLqLGTc7w=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=t8/mhBn5svQGQDCfkMVg27kDGWWI3NRZ9FCKf1bMuCeKBoJw/ebBapU0i4m6FRabo RWbXegZgQgmzRK33/NeZY8ABVBPqW9QYkOQxwQXui7iEnTUaOQRNwNAWc9soMes5hn HkpAGcswL4Z3anaFjtxlPkWEEZSi779nfFlgfwq8= 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 A592538582B9 for ; Thu, 22 Sep 2022 01:41:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A592538582B9 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28M1DdWC019547; Thu, 22 Sep 2022 01:41:51 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jrdp1gumq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Sep 2022 01:41:51 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 28M1FV1e025577; Thu, 22 Sep 2022 01:41:50 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jrdp1gukx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Sep 2022 01:41:50 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28M1a1AD021595; Thu, 22 Sep 2022 01:41:48 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 3jn5gj5wqe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Sep 2022 01:41:47 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28M1fjaf25428412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 01:41:45 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 81C62A4054; Thu, 22 Sep 2022 01:41:45 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D843CA405C; Thu, 22 Sep 2022 01:41:43 +0000 (GMT) Received: from [9.200.40.106] (unknown [9.200.40.106]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 22 Sep 2022 01:41:43 +0000 (GMT) Message-ID: Date: Thu, 22 Sep 2022 09:41:42 +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] rs6000: Fix the condition with frame_pointer_needed_indeed [PR96072] X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: yX1_YgbE8i9At26sZaAGfl3Ak0enImOI X-Proofpoint-GUID: z5xpkO_jlmsYuTExUNMjrLENkRaKLdXE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-21_13,2022-09-20_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 suspectscore=0 mlxscore=0 phishscore=0 impostorscore=0 bulkscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220007 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, 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: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Cc: Peter Bergner , David Edelsohn , Segher Boessenkool Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1744632293356606129?= X-GMAIL-MSGID: =?utf-8?q?1744632293356606129?= Hi, As PR96072 shows, the code adding REG_CFA_DEF_CFA reg note makes one assumption that we have emitted one insn which restores the frame pointer previously. That part of code was guarded with flag frame_pointer_needed before, it was consistent, but later it was replaced with flag frame_pointer_needed_indeed since commit r10-7981. It caused ICE due to unexpected NULL insn. This patch is to make the conditions consistent. Bootstrapped and regtested on powerpc64-linux-gnu P7 and powerpc64le-linux-gnu P9 and P10. Is it ok for trunk? BR, Kewen ----- PR target/96072 gcc/ChangeLog: * config/rs6000/rs6000-logue.cc (rs6000_emit_epilogue): Update the condition for adding REG_CFA_DEF_CFA reg note with frame_pointer_needed_indeed. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr96072.c: New test. --- gcc/config/rs6000/rs6000-logue.cc | 2 +- gcc/testsuite/gcc.target/powerpc/pr96072.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr96072.c -- 2.27.0 diff --git a/gcc/config/rs6000/rs6000-logue.cc b/gcc/config/rs6000/rs6000-logue.cc index 51f55d1d527..41daf6ee646 100644 --- a/gcc/config/rs6000/rs6000-logue.cc +++ b/gcc/config/rs6000/rs6000-logue.cc @@ -4956,7 +4956,7 @@ rs6000_emit_epilogue (enum epilogue_type epilogue_type) a REG_CFA_DEF_CFA note, but that's OK; A duplicate is discarded by dwarf2cfi.cc/dwarf2out.cc, and in any case would be harmless if emitted. */ - if (frame_pointer_needed) + if (frame_pointer_needed_indeed) { insn = get_last_insn (); add_reg_note (insn, REG_CFA_DEF_CFA, diff --git a/gcc/testsuite/gcc.target/powerpc/pr96072.c b/gcc/testsuite/gcc.target/powerpc/pr96072.c new file mode 100644 index 00000000000..23d1cc74ffd --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr96072.c @@ -0,0 +1,14 @@ +/* { dg-options "-O1" } */ + +/* Verify there is no ICE on 32 bit environment. */ + +void +he (int jn) +{ + { + int bh[jn]; + if (jn != 0) + goto wa; + } +wa:; +}