From patchwork Fri Jan 28 18:03:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Qing Zhao X-Patchwork-Id: 1585837 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=Ftk+jQXb; dkim-atps=neutral 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+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JllqY750Rz9t56 for ; Sat, 29 Jan 2022 05:10:16 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F2398385C407 for ; Fri, 28 Jan 2022 18:10:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F2398385C407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1643393414; bh=rSlco8+5a3X6/H2YxXsgNBnJrmaOm1GMxP/f0BPtj5w=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Ftk+jQXb7BugCntDiZQq26eDaUm1TmeXZ9Cb880vnWT/ZeC+C1iUatn6BmhTM9pdE nxyJ/hg4flVQXGgplXubQul9nZttnKTFKUT+ZJypCGpzB7DF99zt5fdvqPDe/gfeV9 5L018mtrPRZIejZ0q+u273y69AlVYBDSpoOIGBEE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id A9BD73948010 for ; Fri, 28 Jan 2022 18:03:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A9BD73948010 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20SGBhDl028338; Fri, 28 Jan 2022 18:03:05 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3duvnkc4mb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Jan 2022 18:03:04 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 20SHv9sH052219; Fri, 28 Jan 2022 18:03:03 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2109.outbound.protection.outlook.com [104.47.55.109]) by userp3030.oracle.com with ESMTP id 3dr72687qs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 28 Jan 2022 18:03:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZxdJJV9pcV40nHckg1f/uvsNkWxuFtZ5iGj3Jd+gER4xch1ZL7uxvDg5wanJVJnFthi07oMcf5HfKapny85R1c5vGqxFg+MDofG/vbnEhnY+PxPLjYv72L9QiiMzfpXubydGTLypcPMvTYJMhtHciD0+un2CvcLQ7Dx8skfL7Bw8lzs4NjeItey4AWTMXeiSYzkphkMzasx/LiYENjqODul0xwJjnle8Z11PHL4e8YmIxj1hXrlWp/9gP9jPst+MYa5KXIylzfu+p3ozLzAgQh+ApWAfiMluJhoYpLkbgNWjToBqbmT4MFgpbrCV35OhFtWxwpt3apagkKjURq3taQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rSlco8+5a3X6/H2YxXsgNBnJrmaOm1GMxP/f0BPtj5w=; b=co7qmv9c+a7htQeX233qPv//5wJt3BVmFbGxsX7Dav6EaqVZKSfg4PhWXDQyuqEh/g2r4JilsT3DgVCZrNE2GrTUnc8Ap4+YvHXGtZBmKonuIvi8U2uhf3p590+uoUykFiXewOuHoBUsADWj6iJw8tTQz5q0cLWkFVZED4ZZWgMQPUk4jWH2u+jsagzIu/jvE1uHhNNcQE3EE2sND5FjCwMesMz0pIMwARWRm4655DEFgcFxHYK45l+/9MK9nL3X0VJyklF/cXdpIGPgx+gfLbnLNA5KcRzC6Of92Kf8IRQWJ3fLjF0bkdyhajb95IWQGMZdYIW8ev+JfEqhfVhnoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from CH2PR10MB4344.namprd10.prod.outlook.com (2603:10b6:610:af::19) by MN2PR10MB3151.namprd10.prod.outlook.com (2603:10b6:208:131::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.13; Fri, 28 Jan 2022 18:03:00 +0000 Received: from CH2PR10MB4344.namprd10.prod.outlook.com ([fe80::d453:6636:7b1d:57f9]) by CH2PR10MB4344.namprd10.prod.outlook.com ([fe80::d453:6636:7b1d:57f9%7]) with mapi id 15.20.4930.019; Fri, 28 Jan 2022 18:03:00 +0000 To: Richard Biener Subject: [Patch]middle-end: updating the reg use in exit block for -fzero-call-used-regs [PR100775] Thread-Topic: [Patch]middle-end: updating the reg use in exit block for -fzero-call-used-regs [PR100775] Thread-Index: AQHYFHFJC5bprC3xs0qfZoLWUbiGqA== Date: Fri, 28 Jan 2022 18:03:00 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3608.120.23.2.7) x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 89d1e97e-d0b9-4e98-fc1a-08d9e2886c1e x-ms-traffictypediagnostic: MN2PR10MB3151:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RKF1eIn0qQCdm3gyC/AwTit+xJ4mEGLrAtWi3Czd0a26sVwH82Cm91l9PiGfY1CAPzxbXQxVfzg1bdVHYLEkp4j+w6bOhHGx6iaERC/4FEIU56FDEyGlSNzpo+WMLXjVoRT6S8LxEXZkgw6fy2JU8Afum6fPPo5+KB2tv4RYHJJSXm14B61RBOQRXtM1HzUdYZuyU0DSpPcIvIIzzg9RpavnJwPHwVJxLlfMlYsMg2qbjIEXFpS5FImtiGRNJiXc1qZxVqXB2W745FqRkIcQ6nu/cPW7PMN1BAE4jBcwJ9lsaPuCirokrldQavlndrgnp/B+jy8h7QjVmulVmpXbPkqSv+o9U39d8Lk50kIdRMrCmgj7eC37ceRqRNhFN2YhAcdPrz8ShqOnDaIY7ORjIgWoEu/nwx+YUFA2Axd1JLIBBvj0AbyHB6JgxsU+OENPgwxLnPWtM4oUGdtNxB/yBa1GBOMYcfOQ3Kd+2r/P/t3earJs4qkGWp+Ud5uvyv69DPqUKSnp2Mv+1feqExMePQz3Y/5Slo+qRIkG3XVa+1tG4F3VYl8hwLqP3QxA9WoQ07DblHqjHRB2A/ZoJYp+Tnidw/TNuVJ6F7v0chIyUkNF0nzwkYLB2S6BvSl5rBmUYPsi3SxL13jizWiBDnOMkJL8O/3GXjoi3mTPlJPsGs6RgNHZ9CdSuC3RrzURsYrDlvtDJJkZ1ojFm4/+Mqr3IJtB9Ddq/LMe1aNXU2gwhKxUfOH5aj5DtNb3all22bMHSnYgzGx78vjIJNgBUdJ4pmfqhuVCR5TNMDJNSuN7BmUBv3H97NrEHU5Zxkl7/ircDQ2zFsVVpTosEITT+aIk8Zkb4w06w8tDd0zt7zydqCM= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR10MB4344.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(66946007)(44832011)(6916009)(76116006)(5660300002)(6512007)(71200400001)(91956017)(4326008)(6506007)(33656002)(966005)(8676002)(83380400001)(86362001)(6486002)(38070700005)(122000001)(66556008)(64756008)(8936002)(2906002)(2616005)(66476007)(316002)(84970400001)(508600001)(186003)(53546011)(38100700002)(36756003)(66446008)(45980500001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?Y6NcwJvUYCF/G8QUwJyAgEQ/K3dO?= =?utf-8?q?wKSLd3mnSURax/qNE4PwhqR9VcAEUzzCXw5htkZ9G8mLpmZOaB5m3vwMvo+7xafKJ?= =?utf-8?q?5TP/Uiz3lhYTvziU7F8zu03tkrc40nQ+ms463p3QZs7o0ev7a0ZRy5SbFX6tSweGO?= =?utf-8?q?jgiInBydrg6XTslkME/TxdHwZBhukRlhO+dPEHQo7Yc56FSfB+frN7LnmBaX6Vmdo?= =?utf-8?q?sYLxtqGa0C/BAUWl9sVVnInSKZO4pOBuhOzQIB+mfWG8W0TzLMf4fBEz2EYfi/iDo?= =?utf-8?q?j/ABvUlmksGdjlxdKgrcNtwWeBz/k1dvbC1hMVSL4jXhGO3PQPS+SXXW5OWxrnpOg?= =?utf-8?q?UhQ7cuCMBdhzXiu/5qHxaCuT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Ma4D+vtZwFQh19fCfrtrwV8gAi9kb4yWScuFs+VK1TC7Ma?= =?utf-8?q?JLrz5AyBnKqPh8fRa5CgtEEhAUeJSyCIg0skX+qZDEh9n9KDu0jWUT+D+3zFEcz4p?= =?utf-8?q?zzzoW9iOccI6epDIUlQV3lxRf3wxDwfwuSYlETVCNWVEt0hpxSXGXiT9YYYk1fT8l?= =?utf-8?q?gteOOzRZpN0IE6rcP4g+DIR3ier+9tg0iUhvoGw3U4GO6ijL3AGXo3fHc0ALuIkvk?= =?utf-8?q?oibg1yh4WXcWjyxws8ScwNtTCPjUPscRS6YjeRZz38pqAGY7EcLZkB2Th2xQVP9jx?= =?utf-8?q?GftIHnrr0zbMS14wYaL7JfZBcScpYdgV3qkDk2bGECMPDiz3C1fkregI+/zwNlSof?= =?utf-8?q?pEx1Htn48vhqOKxIa+D4TwKwHzkGIWYeA=3D=3D?= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH2PR10MB4344.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89d1e97e-d0b9-4e98-fc1a-08d9e2886c1e X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jan 2022 18:03:00.6254 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: D+N0OMVZ0MlXlOdFDBdIuhV/NPKD5eTHYUXj1cpEB9jZ5SJeHbsTXeuhtxWdEWsM7/p/Vg0DqpRhZxFNg1FeaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3151 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10240 signatures=669575 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 adultscore=0 spamscore=0 bulkscore=0 mlxscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2201280107 X-Proofpoint-GUID: FZ37faCr4Ys5TwkdIR7MX6LwMuarDlxX X-Proofpoint-ORIG-GUID: FZ37faCr4Ys5TwkdIR7MX6LwMuarDlxX X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Qing Zhao via Gcc-patches From: Qing Zhao Reply-To: Qing Zhao Cc: gcc-patches Paul A Clarke via Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, PR 100775 ( ICE: in df_exit_block_bitmap_verify, at df-scan.c:4164 with -mthumb -fzero-call-used-regs=used) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100775 Although the ICE only happens on arm, but this is a bug in the middle end. So, I think this bug has higher priority, Need to be included into gcc12, and also need to be back ported to gcc11. In the pass_zero_call_used_regs, when updating dataflow info after adding the register zeroing sequence in the epilogue of the function, we should call "df_update_exit_block_uses" to update the register use information in the exit block to include all the registers that have been zeroed. The change has been bootstrapped and reg-tested on both x86 and aarch64 (with -enable-checking=yes,rtl,df). Since I cannot find an arm machine, no bootstrap and reg-tested on arm yet. For the arm failure, I just tested it with the cross build and it has no issue withe the fix. (One question here: Previously, I though “df_set_bb_dirty (EXIT_BLOCK_PTR_FOR_FN (cfun))” and a later “df_analyze()” should rescan the changed exit block of the function, and update all the df info automatically, it apparently not the case, the register use info at exit block is not automatically updated, we have to add an explicitly call to “df_update_exit_block_uses”. I checked the pass_thread_prologue_and_epilogue, looks like it also explicitly calls “df_update_entry_exit_and_calls” to update the register use info. Shall the “df_set_bb_dirty” + “df_analyze” automatically update the reg use info of the dirty block?). Let me know whether there is any issue with the fix? Thanks Qing =================================== From e1cca5659c85e7c536f5016a2c75c615e65dba75 Mon Sep 17 00:00:00 2001 From: Qing Zhao Date: Fri, 28 Jan 2022 16:29:51 +0000 Subject: [PATCH] middle-end: updating the reg use in exit block for -fzero-call-used-regs [PR100775] In the pass_zero_call_used_regs, when updating dataflow info after adding the register zeroing sequence in the epilogue of the function, we should call "df_update_exit_block_uses" to update the register use information in the exit block to include all the registers that have been zeroed. 2022-01-27 Qing Zhao gcc/ChangeLog: * function.cc (gen_call_used_regs_seq): Call df_update_exit_block_uses when updating df. gcc/testsuite/ChangeLog: * gcc.target/arm/pr100775.c: New test. --- gcc/function.cc | 1 + gcc/testsuite/gcc.target/arm/pr100775.c | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/pr100775.c diff --git a/gcc/function.cc b/gcc/function.cc index e1d2565f8d92..c8a77c9a6246 100644 --- a/gcc/function.cc +++ b/gcc/function.cc @@ -5942,6 +5942,7 @@ gen_call_used_regs_seq (rtx_insn *ret, unsigned int zero_regs_type) /* Update the data flow information. */ crtl->must_be_zero_on_return |= zeroed_hardregs; df_set_bb_dirty (EXIT_BLOCK_PTR_FOR_FN (cfun)); + df_update_exit_block_uses (); } } diff --git a/gcc/testsuite/gcc.target/arm/pr100775.c b/gcc/testsuite/gcc.target/arm/pr100775.c new file mode 100644 index 000000000000..dd2255a95492 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr100775.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-mthumb -fzero-call-used-regs=used" } */ + +int +foo (int x) +{ + return x; +}