From patchwork Wed Jul 12 11:05:10 2023 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: 119083 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1067056vqm; Wed, 12 Jul 2023 04:06:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlFERPpapj2xPATGqlQv+50pr3iFYgOlXgDXy4cvdxZTM3M9RMgRthJjIjdWfLKSBYHmev5x X-Received: by 2002:aa7:cad9:0:b0:51d:d2b9:54a0 with SMTP id l25-20020aa7cad9000000b0051dd2b954a0mr16888997edt.2.1689159983474; Wed, 12 Jul 2023 04:06:23 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id u12-20020aa7d88c000000b0051da02e98dasi4220166edq.242.2023.07.12.04.06.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 04:06:23 -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=Dyq+6KM9; arc=fail (signature failed); 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 3175F3857721 for ; Wed, 12 Jul 2023 11:06:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3175F3857721 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689159982; bh=KP1QFj8XFw5OSARfbhy1AcZ0dtSxRcNA9lybr92BnW8=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Dyq+6KM9gI2YO17vmnHsQYqa/K+TFD00VuUvrMRH3rHChnyxPOig7TWiP2He7NfYx wR6niGcFN8vaatjFgU2fRqNXttcJ1P3dR3X/BGKxfOIYDi85eJ6qNLovL7WvorqOOo Otigg1XnJgRRkngrjVgZano+HbYPgB3S3ElG14f4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by sourceware.org (Postfix) with ESMTPS id 016B2385800A for ; Wed, 12 Jul 2023 11:05:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 016B2385800A X-IronPort-AV: E=Sophos;i="6.01,199,1684825200"; d="scan'208";a="219990596" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 12 Jul 2023 04:05:29 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 12 Jul 2023 04:05:15 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Wed, 12 Jul 2023 04:05:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=btlnZcN8WGGV5cnrD1c9JrHjAAC8MUKVTZpXIZqh7+4INOBf0RE9V2HZ2Sl+tiWKF3uk3LO5R7frbqsu2ffrKBFtaHv8rEfRXb9ei7W/v9lfn5kOrWOS1s/YTz2eY/LLab6eBsvTwXN2flyYJVfDeoHEWkSy8E+bgbzZ4mp4xZRRzc9Yt+EStnYjy3QFQobhtI2gOgQEBRROhuRCRRsv4TcJ2HWeMn9z+1JV3zn7IqOcoSurqFJQz/XSsWDkaV4L0MIlUWlVZTlP8SByfelcSG4zTchozyAtC08x4tIv1qj0i6RnBpSn7aei1CIIzXqQi4lAf1bjKCniOYOGN7P2Tg== 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=KP1QFj8XFw5OSARfbhy1AcZ0dtSxRcNA9lybr92BnW8=; b=Emx3aoJZ1+LxWbMszjvRiwNCmmNLfH75fmMAlCcSaNmanTnyCwAyzYtT1CkZFdeURA1OXbggbIsmFOmrno9ef+k+hKmkfwmuraW7X4+P8irShszA2eGlYzCFn5jDTljTjdLcjnGRFIG2bjAaglEYVoLnqq9LedcvF9qVLF/SstBkkJIZARZT7jKTRtgSE7JEHxhBtP8BfrQ3NvOzE/GTgfkRzo9PjhU29E0Qvz/UGahUPbw9QxF5MdHXhW90UYtCtZS6SyiEhqWnrwQrhJZaHaxQdNRE0oQ5YqVsEs7lhNKoiVPBPPnp1gzFDKPkaRspEEBSkYvGlTJJT6hp6zLRtQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none Received: from DS0PR11MB7877.namprd11.prod.outlook.com (2603:10b6:8:f4::7) by PH7PR11MB8009.namprd11.prod.outlook.com (2603:10b6:510:248::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.47; Wed, 12 Jul 2023 11:05:11 +0000 Received: from DS0PR11MB7877.namprd11.prod.outlook.com ([fe80::c669:ab93:b961:d74b]) by DS0PR11MB7877.namprd11.prod.outlook.com ([fe80::c669:ab93:b961:d74b%3]) with mapi id 15.20.6565.028; Wed, 12 Jul 2023 11:05:10 +0000 To: CC: Subject: [IRA] Skip empty register classes in setup_reg_class_relations Thread-Topic: [IRA] Skip empty register classes in setup_reg_class_relations Thread-Index: AQHZtLC5i+H2aL2MWUWqRqfnrVZ4YQ== Date: Wed, 12 Jul 2023 11:05:10 +0000 Message-ID: <4c71614eec51bbefe18602f3fb6301efcf33f477.camel@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Evolution 3.36.5-0ubuntu1 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DS0PR11MB7877:EE_|PH7PR11MB8009:EE_ x-ms-office365-filtering-correlation-id: 57a3b6ed-edbb-4421-c47d-08db82c7dbe3 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VxNICTopWxad/FhNJXc/g4VrLWuFYYvJTFePtwMYxJvcd+cGJYnV7ky8jde3OqynaynrfN/1ZB7313J+jT2lFHuUJt9lH5epHbdnuQ7dvqCdrLA1NcDH3sQmqC/EJ2TsaLYmYtFHYTLT+5JlCkNf5u0E60lGDfoU7HStt4nxlciL29Ep5/wNFX+JRHYBWSreDvpw7YaJUFtWJb5bUSvF6B5CVmDh0X+4/zZfrWMni6J3RVs+L+ux87hiXfbBFQvzc56n8W3i5Gm1Ycq/jf3tPOt+rcArVnkFEzWujPq68eQTgH1uXu/g8yWRsvsp/P5Nhgtd1pJLxT4+CLb3hcjl33pby079Y09yesbPpgvz8CJvJlgeoGLzfpN0PZorfql7Oz8OWljYaCd2O4xWgWPWHAw2YHlErx6ArCUh84pnv3L95oR4ZwSNA8lTlZnEwnwdeK/qlpGm8Q1DORHyTTFKDagerNG+uJQ76lu8QRbm5jhG6uAymaP5fcGWbD8FrZqin+5smgk1t/ghd+D8JZ40BDknsaN238aArlGPrOOT2ryLy0xiVe7Uttw2BjisMnzxcLy9PlebgCFCUBNqyJnUTY1E/b2RfC3PoKwINtsF4ZY8PzFbPCcoe0X45fkZTiwm x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7877.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(136003)(346002)(396003)(39860400002)(451199021)(478600001)(6486002)(91956017)(71200400001)(2616005)(36756003)(86362001)(38070700005)(2906002)(26005)(6506007)(186003)(6512007)(122000001)(38100700002)(66556008)(66476007)(66446008)(64756008)(76116006)(6916009)(66946007)(4326008)(41300700001)(316002)(8676002)(8936002)(5660300002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?3LqUHom0bkTBjZpezYtCHINLKRcA?= =?utf-8?q?ZcoHTD1sqHvAaJwPc+nRzgr8B0TUsDqZkLeiu1+QdUxlUgg44OgKPtoCablELSjhW?= =?utf-8?q?JGBz5r/aO1kijwq5jQ3vh3ARdSPcy5hd3HAqSibZbn/8mOt8PWLl6CquH2VsQzo9C?= =?utf-8?q?eTi0l65JR2FE29IDrHFKDQjmh3zKepbWvzzafzumsrpXU7iYsIQEJiGD5wofcjDhJ?= =?utf-8?q?lo3wCzJKYR7OcDc/HzcajdAYfhzL0aEo5RICo3glD/9DpkUHnAMjHboHeeIOstTlZ?= =?utf-8?q?ay0Wns0TQDBBjbEy6Fa01tuCtYBg/M8Vf+0llCxHd7zNSNbTBhxsxUZfFJ59ocK4I?= =?utf-8?q?ZGh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KE4tTsBQZxbEe/PJpRNYUcBHUJ9UwbTu+YoDAzNu3U1qHQll8iBjO?= =?utf-8?q?m+pXn4aBPC1rh12yE9D+0wHLGcDTxYpYu92MpYMpTtDVCTvaNuzkhwbhBtDd2/Nfi?= =?utf-8?q?LjI/ikigHAJOrZssCA9n4aVfjh6gITGN6PCVpT3cxGc16/9JTVZRSOYky+UVDnLBJ?= =?utf-8?q?BJ5HhIzhdqJJoTbN5z6sNQCROfKXlB2lor45r9pay+Bfwt8OXc+9F1IEqrUfl3M/a?= =?utf-8?q?hb94h2DTDk/iRy403Fq8fD2UqNZscLfYK8eJB9qkVzEVaS1Gojy2itpEfPQdFqpid?= =?utf-8?q?WI6K/uUwq7z9dgPGSciA6N7nBh700Ce9T1tu30uUXjI19XlmctrGAnw=3D?= Content-ID: MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7877.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57a3b6ed-edbb-4421-c47d-08db82c7dbe3 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jul 2023 11:05:10.1803 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 3Mmu+VbExV1Bv0JibbOY4Hnva1PgluTrSU/ogEUnkQ2ysfRfhjR2cFtZzq+Q90338PBRhE4Leov+vLr6rViRK9OmkK/aYftSNiRE2CkxFy/TUUgJLgxmnyJZQLc2xrYa X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB8009 X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, WEIRD_PORT 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: "SenthilKumar.Selvaraj--- via Gcc-patches" From: "Li, Pan2 via Gcc-patches" Reply-To: SenthilKumar.Selvaraj@microchip.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771212618697460296 X-GMAIL-MSGID: 1771212618697460296 Hi, I've been spending some (spare) time trying to get LRA working for the avr target. After making a couple of changes to get libgcc going, I'm now hitting an assert at lra-constraints.cc:4423 for a subarch (avrtiny) that has a couple of regclasses with no available registers. The assert fires because in_class_p (correctly) returns false for get_reg_class (regno) = ALL_REGS, and new_class = NO_LD_REGS. For avrtiny, NO_LD_REGS is an empty regset, and therefore hard_reg_set_subset_p (NO_LD_REGS, lra_no_alloc_regs) is always true, making in_class_p return false. in_class_p picks NO_LD_REGS as new_class because common_class = ira_reg_class_subset[ALL_REGS][NO_REGS] evaluates as NO_LD_REGS. This appears wrong to me - it should be NO_REGS instead (lra-constraints.cc:4421 checks for NO_REGS). ira.cc:setup_reg_class_relations sets up ira_reg_class_subset (among other things), and the problem appears to be a missing continue statement if reg_class_contents[cl3] (in the innermost loop) is empty. In this case, for cl1 = ALL_REGS and cl2 = NO_REGS, cl3 = NO_LD_REGS, temp_hard_regset and temp_set2 are both empty, and hard_reg_subset_p (, ) is always true, so ira_reg_class_subset[ALL_REGS][NO_REGS] ends up being set to cl3 = NO_LD_REGS. Adding a continue if hard_reg_set_empty_p (temp_hard_regset) fixes the problem for me. Does the below patch look ok? Bootstrapping and regression testing passed on x86_64. Regards Senthil gcc/ChangeLog: * ira.cc (setup_reg_class_relations): Skip if cl3 is an empty register class. --- gcc/ira.cc +++ gcc/ira.cc @@ -1259,6 +1259,9 @@ setup_reg_class_relations (void) for (cl3 = 0; cl3 < N_REG_CLASSES; cl3++) { temp_hard_regset = reg_class_contents[cl3] & ~no_unit_alloc_regs; + if (hard_reg_set_empty_p (temp_hard_regset)) + continue; + if (hard_reg_set_subset_p (temp_hard_regset, intersection_set)) { /* CL3 allocatable hard register set is inside of