From patchwork Tue Jan 28 20:52:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 1230651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-518445-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=jp0SqD2l; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NptJZYjw; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 486f2h2x0mz9sNT for ; Wed, 29 Jan 2020 07:52:58 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=w8XT+PlEr7BY7FrdgOGYju1qaciZ+VH4bRz0kwP5BH9B7T/9LC v5X62G+Gx5FOB5HywTVioNNFL/DjAMB6/uHiCsuNpkpcedCMYD7UbXsoYys+pnds f92kdyH6UjAi/4+uahg0AraP8zuhAsdY+mECJyCfuOcnBaYPcletfULPw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=zekMsU4/NRt4H0TqK1p3uwTEGL4=; b=jp0SqD2lBrN8+VTuYQ6N 5K0YFJ9iQ1gxbHPlwMAgFZUCbcxsd34i+DwRHaC5/MHB1TeHiQogLQKErQkEexv4 iph3Qc1h1rssI8PUlW589nSmObNR1TWx/fjkDv3mNYgJq+RZnqRljQFCmmyA+hEQ CDhNDPnsscHw9IWQi0KpimU= Received: (qmail 67533 invoked by alias); 28 Jan 2020 20:52:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 67523 invoked by uid 89); 28 Jan 2020 20:52:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=(unknown) X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Jan 2020 20:52:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580244767; 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=bE/0U61JqiwoUQok0nOIpDJGF6pOitvZ/B1ihyPI3P8=; b=NptJZYjwYxKL/H6uj37GlPO8F25ZNmzLpcRR6I90tNJRARmPbfpkM17C2j0xQQFNZTeS6n RtuQFuGrvGC6SufPbJCRcB4Z3gNeYmu5/MD6QXk9YKM71E5IOrTddl6QcpVB1LI4Rt0CLS X2IgMNlj/yp1R4gYlpfzyxQcRFuugjI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-12-eFoNUY7SP6K3CiSnHAxjfg-1; Tue, 28 Jan 2020 15:52:41 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 55F6F1005510 for ; Tue, 28 Jan 2020 20:52:40 +0000 (UTC) Received: from tobol.usersys.redhat.com (unused-10-15-17-174.yyz.redhat.com [10.15.17.174]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25C05100194E for ; Tue, 28 Jan 2020 20:52:40 +0000 (UTC) To: gcc-patches From: Vladimir Makarov Subject: Patch to fix PR93272 Message-ID: <2726f098-5c0a-bf10-cfd2-49ff29252d90@redhat.com> Date: Tue, 28 Jan 2020 15:52:39 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-IsSubscribed: yes The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93272 The patch was successfully tested and bootstrapped on x86_64. Unfortunately it is hard to create a test case for the patch.  So there is no test for this PR. commit 5c8a1211b9873a1b69ef7b2fddae181535bc3b0a (HEAD -> master, origin/master, origin/HEAD) Author: Vladimir N. Makarov Date: Tue Jan 28 15:43:44 2020 -0500 Fix for PR93272 - LRA: EH reg allocated to hold local variable 2020-01-28 Vladimir Makarov PR rtl-optimization/93272 * ira-lives.c (process_out_of_region_eh_regs): New function. (process_bb_node_lives): Call it. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 326250b9b96..8d60dcf0864 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-01-28 Vladimir Makarov + + PR rtl-optimization/93272 + * ira-lives.c (process_out_of_region_eh_regs): New function. + (process_bb_node_lives): Call it. + 2020-01-28 Jan Hubicka * coverage.c (read_counts_file): Make error message lowercase. diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c index 155f825ea8d..f776fd2342f 100644 --- a/gcc/ira-lives.c +++ b/gcc/ira-lives.c @@ -1160,6 +1160,50 @@ non_conflicting_reg_copy_p (rtx_insn *insn) return SET_SRC (set); } +#ifdef EH_RETURN_DATA_REGNO + +/* Add EH return hard registers as conflict hard registers to allocnos + living at end of BB. For most allocnos it is already done in + process_bb_node_lives when we processing input edges but it does + not work when and EH edge is edge out of the current region. This + function covers such out of region edges. */ +static void +process_out_of_region_eh_regs (basic_block bb) +{ + edge e; + edge_iterator ei; + unsigned int i; + bitmap_iterator bi; + bool eh_p = false; + + FOR_EACH_EDGE (e, ei, bb->succs) + if ((e->flags & EDGE_EH) + && IRA_BB_NODE (e->dest)->parent != IRA_BB_NODE (bb)->parent) + eh_p = true; + + if (! eh_p) + return; + + EXECUTE_IF_SET_IN_BITMAP (df_get_live_out (bb), FIRST_PSEUDO_REGISTER, i, bi) + { + ira_allocno_t a = ira_curr_regno_allocno_map[i]; + for (int n = ALLOCNO_NUM_OBJECTS (a) - 1; n >= 0; n--) + { + ira_object_t obj = ALLOCNO_OBJECT (a, n); + for (int k = 0; ; k++) + { + unsigned int regno = EH_RETURN_DATA_REGNO (k); + if (regno == INVALID_REGNUM) + break; + SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno); + SET_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno); + } + } + } +} + +#endif + /* 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 @@ -1213,6 +1257,10 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node) EXECUTE_IF_SET_IN_BITMAP (reg_live_out, FIRST_PSEUDO_REGISTER, j, bi) mark_pseudo_regno_live (j); +#ifdef EH_RETURN_DATA_REGNO + process_out_of_region_eh_regs (bb); +#endif + freq = REG_FREQ_FROM_BB (bb); if (freq == 0) freq = 1;