From patchwork Wed Dec 21 13:12:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?RGltaXRyaWplIE1pbG/FoWV2acSH?= X-Patchwork-Id: 55376 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 811713850F1F for ; Wed, 21 Dec 2022 13:13:03 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2109.outbound.protection.outlook.com [40.107.20.109]) by sourceware.org (Postfix) with ESMTPS id DBFD538582A3 for ; Wed, 21 Dec 2022 13:12:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DBFD538582A3 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=syrmia.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Syrmia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HkjPfx4YNTsnVlnx8/gamMe9yUERunXaRobAzCzhosDCAvtzrkbTUCdgaoFCTauhxPodw62bwN7vc4CEkJLY28tiOmKjkC8rUQG0PD49Y5G14CaqJKMnPp6VI+e0UglGQVjElC/2xsLmQz6mPNDW47KqFBe00YY7qzqNEl8+6sgCtqXOwUVsh7aVMxm0lNWra3CZi5B3HsRjDOrD3Hqlaq3t1ijINS/ZRObt3oiDr1oE8J4jdxucsFM2arOCilS0feLfBWVPg/hPjDgggYELlCkarZCjeyNSnETMT+tSvBg4Ztnsue53Qi7VNDnKnqtvGH6jNA3t4BQWq1emu+kHng== 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=AhJP5SzfLcmehc2Kuy8AjpldFDSa/Sthqi7GfFvWChk=; b=j7tNgMneHulJc95pTBcbB2VO5SEvIGohUWLlvCJUvXrxpDeKobX5YB+35b3moF9MSpl+LOITFNZ6p65MqVDImZ1MtkxKhNMPs5VRPYXYO+wOzaF8PpGs3LtTqU4eMAcZy2s9cK6m4ZM7Kg/RLMwJ+JqdSn/ErCBOTYWKuwKArvGO9TYgtSSsZPJGlm4+YzgyndReCtifaM6GAzXZ/75KH1xr7SqaQz221Sv02XINYVVUNdbsMQp5R2IqOuxMku36uGsR07NVBhkxsaob05Q3x0R//Vok6RGLnKW1cfviXT/L6pROy+sOg423vVLXofcQ5dUoNSO9EYVZ7VOA769v/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=syrmia.com; dmarc=pass action=none header.from=syrmia.com; dkim=pass header.d=syrmia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrmia.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AhJP5SzfLcmehc2Kuy8AjpldFDSa/Sthqi7GfFvWChk=; b=djtT0Zr4nmc0JBi2UAPnzgyH0RGDy1SHY6b1jWGzmNgpkdkWEDH6I7twGIuAQ2349Q60AUjEI5Wy5s6OxoVb0lFhUo7uFYXoy3RYARAmWU6LZEWS3UyNJUZAOeSB4duQSfKj1UZuVyCUfIb2F6V9sOpfzUia+0ujf7LNn4ZImPY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=syrmia.com; Received: from AM0PR03MB4882.eurprd03.prod.outlook.com (2603:10a6:208:fb::17) by PAXPR03MB8225.eurprd03.prod.outlook.com (2603:10a6:102:24c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 13:12:37 +0000 Received: from AM0PR03MB4882.eurprd03.prod.outlook.com ([fe80::6d55:c3be:1328:429b]) by AM0PR03MB4882.eurprd03.prod.outlook.com ([fe80::6d55:c3be:1328:429b%7]) with mapi id 15.20.5924.016; Wed, 21 Dec 2022 13:12:37 +0000 From: =?utf-8?b?RGltaXRyaWplIE1pbG/FoWV2acSH?= To: gcc-patches@gcc.gnu.org Cc: djordje.todorovic@syrmia.com, richard.guenther@gmail.com, jeffreyalaw@gmail.com Subject: [PATCH 0/2]: Fix address cost complexity and register pressure cost calculation. Date: Wed, 21 Dec 2022 14:12:12 +0100 Message-Id: <20221221131214.190579-1-dimitrije.milosevic@syrmia.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: VI1PR0102CA0022.eurprd01.prod.exchangelabs.com (2603:10a6:802::35) To AM0PR03MB4882.eurprd03.prod.outlook.com (2603:10a6:208:fb::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR03MB4882:EE_|PAXPR03MB8225:EE_ X-MS-Office365-Filtering-Correlation-Id: 975766fd-7b73-4d42-f59c-08dae35507ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uwdJfhqpU2HlWs+HpT0FH/DYuDULKqnTBcnRc8hmMumj7FwOJz7/gJpzrj8TWSjVKfou0J8912krhwE1E9v5jYPH2SteThlMaK5GE0s6A1wLcvp6e7OKLQvK4Gh9hoANYlsHH40/yMNJEFlBQoYrIR9g4UlxGb/IzJ/4qQgWueYPuIN2PRqNmnzYjAw0mKFXKTnhaLbUIcPIdhhPQbrRoW4loFfOJc5YvS1dCgwmTzJ/HKPLWreV6T6zwIIbv8UsH5BtFTZNlo8cTuy2kSjf2KbbsOvENniars0BeurA5tkPLmDLqG14mJdQx2iAOEAD7Prea4pJIzh70/xRlIUJQRgQUCeheEgN+QnmtgtV5Tw4rLCHS7cPVKBo382PN1M+XgACcIhkDueCi16oxAUeKRImODBTJUT/RE1ZP5mnIAUbfq3/SYLLBraqTLhuSXNfZ+GWtaHW3HdMUz193pCSlK6VqOmg5PEuYxrfqIBNsRcoOdKlYgikEedD/O225rFa+JP2xIbLSMgDzCDJQAzdGVM22JmETpISr+Iy6EuaGR/9+8HoNR4oJiKmReE98yesOD+w3r3N2mXMTxipJtwacn0MSVIx6uwvE6lVGXZr8rhp6gvvJ4tLQDWL84Gwmjh132wXnn85dFKB9o4mLiJLczAVad/tMESd+9wRgBg2C9mKxo3E75Be1L/PnJeDRwdz X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR03MB4882.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(39840400004)(366004)(136003)(376002)(346002)(451199015)(2906002)(38350700002)(36756003)(38100700002)(86362001)(478600001)(6666004)(6916009)(316002)(83380400001)(5660300002)(2616005)(6486002)(1076003)(6512007)(26005)(8676002)(52116002)(66476007)(66946007)(4326008)(66556008)(186003)(41300700001)(8936002)(6506007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?52gPUtZJNj6dyOVY7wGHLfEj4UEn?= =?utf-8?q?DhIlZL8LHCJETlnRrfWmLW1wEA5e24UJEAwrikPVMAQqpHy1MR2CHRA27VLyc+3Dn?= =?utf-8?q?YwO1xZ+j7NEaEDXnxpfUWw69NhoLq0/vcVavCusocVrzsEl5OpF1PyaSHZef/eSh/?= =?utf-8?q?dzKsljoo3gUNpnRY+QcQrYjthqQ86ayrr2oTDGg/5cK9bPze6+FO2wo0745+TDuyb?= =?utf-8?q?wddHICMb6HE16pciL84HiFWf2qZi270bidC31gxoZvacAsfAFzbSgPLynAmeNfbvJ?= =?utf-8?q?sgaQ877rZAPZ2AVHnOg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DOWDBn15XZLLybxt0HpOAunumPZpp2OGl6Dl?= =?utf-8?q?ve+f8ybRArQD4LmNgo5h8EuYPjI+cOiwe+D/h333rw8p7uHuWoVj6MdIZx8HLH1Ee?= =?utf-8?q?6i4bMeatV3SCT8JROxI48s6xq3QrG/XYmYtUV4DoSmdRWQverpo9tdQ5HECIpsImy?= =?utf-8?q?J6o6R3ViSK/khETOhZ1SqEPIORdXjVFajJ7OJoCkS4bilrcWurQ7S1DaO3plpwQ1w?= =?utf-8?q?itGzbIlMGscpGTjyiHP+GXszv/CKCttnlSPTbTIBataIn5WXwAbsslOd0DuXmYU1k?= =?utf-8?q?TJA98tqwAVTR6EbGkrtlXB92917X19F6rWa2yR5fQsLfWNzx9x/pEjhUkMBuEbCof?= =?utf-8?q?CCMdzLttmzPgCujo0JdpYcc7rc3JaSoKwnc/CkPH5jYubPWhwGZOGcs=3D?= X-OriginatorOrg: syrmia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 975766fd-7b73-4d42-f59c-08dae35507ee X-MS-Exchange-CrossTenant-AuthSource: AM0PR03MB4882.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 13:12:37.3203 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 19214a73-c1ab-4e19-8f59-14bdcb09a66e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ihBK14hNHSGqDREnBONrRGwajpUyKd0pFR6MAdyLLIi38Tu/UQ8wRJPdTYcp537RKQuVAciMZX+aPHupFxh5th40Appd6Y6YMX2iUjsDATE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR03MB8225 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_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Architectures like Mips are very limited when it comes to addressing modes. Therefore, the expected behavior would be that, for the BASE + OFFSET addressing mode, complexity is lower, while, for more complex addressing modes (e.g. BASE + INDEX << SCALE), which are not supported, complexity is higher. Currently, the complexity calculation algorithm bails out if BASE + INDEX addressing mode is not supported by the target architecture, resuling in 0-complexities for all candidates, which leads to non-optimal candidate selection, especially in scenarios where there are multiple nested loops. Register pressure cost model isn't optimal for the case when there are enough registers. Currently, the register pressure cost is bumped up by another n_cands, while there is no reason for the register pressure cost to be equal to n_cands + n_invs (for that case). Adding another n_cands could be used as a tie-breaker for the two cases where we do have enough registers and the sum of n_invs and n_cands is equal, however I think there are two problems with that: - How often does it happen that we have two cases where we do have enough registers, n_invs + n_cands sums are equal, and n_cands differ? I think that's pretty rare. - Bumping up the cost by another n_cands may lead to cost for the "If we do have enough registers." case to be higher than for other cases, which doesn't make sense. Dimitrije Milosevic (2): ivopts: ivopts: Compute complexity for unsupported addressing modes. ivopts: Revert register pressure cost when there are enough registers. gcc/tree-ssa-loop-ivopts.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- 2.25.1