From patchwork Thu Nov 9 18:25:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 163537 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp623956vqs; Thu, 9 Nov 2023 10:26:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2v0f1dGUQihk90EkKt/B1mb0jNEBgBT6oidD+cM8CjSCSSFERNTmwuUVQRuqBMHpAzyDd X-Received: by 2002:a0d:d597:0:b0:5a1:e4bf:ee5a with SMTP id x145-20020a0dd597000000b005a1e4bfee5amr6174420ywd.41.1699554375149; Thu, 09 Nov 2023 10:26:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699554375; cv=pass; d=google.com; s=arc-20160816; b=Otkzb+rJ8AOzhTvp5Ju8NlhbopnLRkh3fwrMTxCJViKNDEE9f0hbM8Ee2pXqzpWz8N xhNR0sRbcHxMAyWe/RD71JoJK4pqFbXy4HSvybvVD4AkwFQhU5Wjo+sT5gMWHNlaYV7g dxl3xMWmC0lZT9jaQLDO4SaY79mzuHISVYFDn3ghIG3tfVWsMf+v+ruNb1gAKHxvoDAn Va7RAFMRu7FOqR6XGlLK1Uh7Y4/B+DskyAn5qPaiuEwCAYCvLzvIhRzMkrgTib0Wzohh M+zAd022ZyHuKP0x48HPn9HA1eimh+sIoamon7J6mJ2JGR8BapKBIEMCHWB7cDWb6W+E A/uw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-language:to:subject :from:user-agent:mime-version:date:message-id:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=cdv6p0F4DKiMvjc4ah/eYidydfblDjwV8s+xpMt+ITU=; fh=XNn3asQvIblazGK92GBt13dVv+YmGV3pBS0JC29ZQco=; b=D4JHC3QwEJ8eF4dBHakQFGTjo+suNDPgioOnIjQ4qAHV76J/XGkIMg6Q5rp6JumKsP A8xCLMlOJnAEeKsZinpAMYHeEKQhkwmw80GOYrFT1m5ydkRx1fr/stcGwiiDPlib6qbi Ta6xwSeaAxG26j6Rbbf1GRcJvIV+vQYxAwEbaw4XIkcEJJ1wzI7hPQcYqsTIXvOK5wzr dc2Q9vuSIaJYVHdbWrFWWNq6ASxesO1zT0Z7g8OoyaTnlhTbjCoC79XWPNBayu6hiQrG FwomaN4T1PFJQccxWpklw15dhvDOHBRR+LJIMsz2lF22lXlZKG16C5ef5kpvU4WtswiB 7D6g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FDgAaJeX; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id w23-20020a05620a095700b0077b93608822si3158337qkw.65.2023.11.09.10.26.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:26:15 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FDgAaJeX; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E07BD3858C2C for ; Thu, 9 Nov 2023 18:26:14 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 2A49C3858D1E for ; Thu, 9 Nov 2023 18:25:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A49C3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2A49C3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699554351; cv=none; b=ZAKosR2miTokkvB7mwANwpZjqIsCbNUwOU+T+tsb7ilCr4WQ3IO0eqwtPsM0pT0WoNHj+GdWjHISdx7qDbiAAy7H9qDGuSCtsw71XF5/LGklgdt5alRNoWWwFalpJX7du5vKytePAk2IGCDlvq4pT0jWJograKQivAglcbQwUOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699554351; c=relaxed/simple; bh=Pq8AVYp7p2EdOMmVRd7YX4hWLiE2JsVD33zjtQlGlYc=; h=DKIM-Signature:Message-ID:Date:MIME-Version:From:Subject:To; b=KabdZu023HHjgf3Zuc01oekAzm1MZYa1jwI7Z9zHORAHsDgNIaLAZ/6RuO7I3BDdaffmnhzxVhFV2PBtoWsbM8/URAc7GRiVfqsvEB1LgDkcyKYzMlgFTG2diupy0Wmumh+8jMYD7RT/YuixXOOsG75bbSrIMZJkYim6LFEdKT0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699554349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=cdv6p0F4DKiMvjc4ah/eYidydfblDjwV8s+xpMt+ITU=; b=FDgAaJeX0Cj6Jgr5fPgJGILqrUH/x8uAdW8rHki2tjnHb0Gm/rcQ6Cs0O/D4R8zPeQE7jW qQmpnfcxtgvKcY/VyYyA57wCaiD9U1E3WNTbuSfEfbGNGUdG6IhtAL1jBO/ipQhAwCNs5b PodgVkeos8R/Ys50sQ6JnBMB9+Og1JM= Received: from mail-oo1-f71.google.com (mail-oo1-f71.google.com [209.85.161.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-610-MddSu2BxPGmbqyAKMUiUrg-1; Thu, 09 Nov 2023 13:25:48 -0500 X-MC-Unique: MddSu2BxPGmbqyAKMUiUrg-1 Received: by mail-oo1-f71.google.com with SMTP id 006d021491bc7-587b3885465so1062099eaf.1 for ; Thu, 09 Nov 2023 10:25:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699554347; x=1700159147; h=to:subject:from:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a6rVDCQ6g0FrxdAbTZlqyIzAl39JsTPbGBPIt6dT3xI=; b=UQkjXDp/i4ww/5CiJnuB0+X2L9KbBRL5IIBCcucVwX6yjlRR8tkUxUYZfNSgEhADky 6X5xpzatKDgVoAj7jqHNbFwnFhRlGT4iCquV327+cI3qu0Z66VmHBkW9xAjLZ8iQby3x +/EuHDsKwIGoz960VDNKdyC0uC6wSdXO3T7J4fBjMRPV3lJWbJkvhAaNnJf1ndRhjUPu V600Xm5fpxXsbZDf+e4J1oOrudHrN9AOtREckNX3ahq8LgqTQ3lrc7D3A1RUj6E7zDnW cb4xbFzlLBB2EVLSCCnyK9isv/A7R7vFnj+p8eZX6p7KsTY23/tTBWe46itiCdqsBzQ/ AxiQ== X-Gm-Message-State: AOJu0YwVDFXWXS7dP6964KweOAEQSjSFVpD9Ua+S9CABtEM/7/XCPILH NLZN9DT0b99CxQjtqCwTZ5ROo9qmqD5NKXBZPY92iEWFti3T57Xn5da1cBwWbd5cPb7Y5KZI6sz 1UFnsJhfrIU0+khLtpwfaXhnQnmr79oUo1TiVLMCP6Gec1mbrxC6I0X/wuEQ7UNDIpODz9XwehP YH3Q== X-Received: by 2002:a05:6358:7209:b0:16b:858c:1ed8 with SMTP id h9-20020a056358720900b0016b858c1ed8mr4889232rwa.5.1699554346786; Thu, 09 Nov 2023 10:25:46 -0800 (PST) X-Received: by 2002:a05:6358:7209:b0:16b:858c:1ed8 with SMTP id h9-20020a056358720900b0016b858c1ed8mr4889218rwa.5.1699554346235; Thu, 09 Nov 2023 10:25:46 -0800 (PST) Received: from [192.168.1.88] (23-233-12-249.cpe.pppoe.ca. [23.233.12.249]) by smtp.gmail.com with ESMTPSA id k5-20020ac80745000000b004198d026be6sm2148324qth.35.2023.11.09.10.25.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Nov 2023 10:25:45 -0800 (PST) Message-ID: <0430c00f-f8b4-dd19-4e47-e76a3e9dccb0@redhat.com> Date: Thu, 9 Nov 2023 13:25:44 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 From: Vladimir Makarov Subject: [pushed] [IRA]: Fixing conflict calculation from region landing pads. To: "gcc-patches@gcc.gnu.org" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782111928282612948 X-GMAIL-MSGID: 1782111928282612948 This is one more patch for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110215 The patch was successfully tested and bootstrapped on x86-64, aarch64, ppc64le. commit df14f1c0582cd6742a37abf3a97f4c4bf0caf864 Author: Vladimir N. Makarov Date: Thu Nov 9 08:51:15 2023 -0500 [IRA]: Fixing conflict calculation from region landing pads. The following patch fixes conflict calculation from exception landing pads. The previous patch processed only one newly created landing pad. Besides it was wrong, it also resulted in large memory consumption by IRA. gcc/ChangeLog: PR rtl-optimization/110215 * ira-lives.cc: (add_conflict_from_region_landing_pads): New function. (process_bb_node_lives): Use it. diff --git a/gcc/ira-lives.cc b/gcc/ira-lives.cc index bc8493856a4..81af5c06460 100644 --- a/gcc/ira-lives.cc +++ b/gcc/ira-lives.cc @@ -1214,6 +1214,32 @@ process_out_of_region_eh_regs (basic_block bb) #endif +/* Add conflicts for object OBJ from REGION landing pads using CALLEE_ABI. */ +static void +add_conflict_from_region_landing_pads (eh_region region, ira_object_t obj, + function_abi callee_abi) +{ + ira_allocno_t a = OBJECT_ALLOCNO (obj); + rtx_code_label *landing_label; + basic_block landing_bb; + + for (eh_landing_pad lp = region->landing_pads; lp ; lp = lp->next_lp) + { + if ((landing_label = lp->landing_pad) != NULL + && (landing_bb = BLOCK_FOR_INSN (landing_label)) != NULL + && (region->type != ERT_CLEANUP + || bitmap_bit_p (df_get_live_in (landing_bb), + ALLOCNO_REGNO (a)))) + { + HARD_REG_SET new_conflict_regs + = callee_abi.mode_clobbers (ALLOCNO_MODE (a)); + OBJECT_CONFLICT_HARD_REGS (obj) |= new_conflict_regs; + OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= new_conflict_regs; + return; + } + } +} + /* Process insns of the basic block given by its LOOP_TREE_NODE to update allocno live ranges, allocno hard register conflicts, intersected calls, and register pressure info for allocnos for the @@ -1385,23 +1411,9 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node) SET_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj)); } eh_region r; - eh_landing_pad lp; - rtx_code_label *landing_label; - basic_block landing_bb; if (can_throw_internal (insn) - && (r = get_eh_region_from_rtx (insn)) != NULL - && (lp = gen_eh_landing_pad (r)) != NULL - && (landing_label = lp->landing_pad) != NULL - && (landing_bb = BLOCK_FOR_INSN (landing_label)) != NULL - && (r->type != ERT_CLEANUP - || bitmap_bit_p (df_get_live_in (landing_bb), - ALLOCNO_REGNO (a)))) - { - HARD_REG_SET new_conflict_regs - = callee_abi.mode_clobbers (ALLOCNO_MODE (a)); - OBJECT_CONFLICT_HARD_REGS (obj) |= new_conflict_regs; - OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= new_conflict_regs; - } + && (r = get_eh_region_from_rtx (insn)) != NULL) + add_conflict_from_region_landing_pads (r, obj, callee_abi); if (sparseset_bit_p (allocnos_processed, num)) continue; sparseset_set_bit (allocnos_processed, num);