From patchwork Fri Jun 16 15:18:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 109192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1419654vqr; Fri, 16 Jun 2023 08:19:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5PnHHbFnPpFg7BKwdyG0J1Q7mUdAytkynCZRztPi8VZ6nBWkoUkqRyl/4d/RugO3PQ4Bbp X-Received: by 2002:a50:fc0d:0:b0:51a:2d86:6f90 with SMTP id i13-20020a50fc0d000000b0051a2d866f90mr1577325edr.3.1686928786288; Fri, 16 Jun 2023 08:19:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686928786; cv=none; d=google.com; s=arc-20160816; b=jWOhxs8CPpy/ZyS905iGboxSGW+BQvBwQv2wOGhJBie59O2CfjByCgMHuQWsFMCKBC ljtis6mWSBobLPBkAZCdzpnPwMhNEdHkf/uI7qRlKcxJa4Zjl+6Jirn00QS3P3pSMPO5 fCxIcm1QIdw9lZj6gStSbdyo4sV+oW8jBMHGKxAzd3zHxK05VGH9Vr1GWowQs2+1dRf9 r6EPcoIr7QFpKy+IIeN0v4PR5jpadF/qI2/KndCHSafSCy6xn/08BevV1F77M5q5O7FP q+qh1oCuzRYsXRihXxd3551wPjznvXMemb0OwDzaP7zyT/NZtCz70DRMvzjtpUPVkLK0 C8pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:content-language :to:subject:user-agent:mime-version:date:message-id:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=FcGNz0ffN5nZtEj+UPGzhSOp5SAdo/+Ko55pGVeoNak=; b=GO+VhKrZYyfolhTpTqO1BqV7nkmM/XF8xjla+wvWm4blP7Ua4KOwEVVojMtKHfmwet L9dYNgNcwyZNQ6cIzFwGLJdqBa1YETMKM03TalqpF02iSeQoNHwtebWgpm7UpVf/iJxv DQwTat/d0KbWVMCxG6J5BuJz2Vh3L5LqMJ5X0Btnrdeb1QwSFfsDgFPS7KYqgs1qjo2j k1qX9oCuQ39XI+ol4mluwIKcNSb/qcXzknWROvt3sVHc09LOsiaKvqRUEjOYjgl8O5O6 Vb4JAGW0IhZv3fkVJKsIanRBLDj0DFv4heK2jC1Gxok1Xnh9kInobxqj1lkq5214Icux XkCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=QAK0Q5BW; 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 sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id z19-20020aa7cf93000000b00514b2a9ce63si10876989edx.147.2023.06.16.08.19.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 08:19:46 -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=QAK0Q5BW; 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 E6E61385770B for ; Fri, 16 Jun 2023 15:19:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E6E61385770B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686928784; bh=FcGNz0ffN5nZtEj+UPGzhSOp5SAdo/+Ko55pGVeoNak=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=QAK0Q5BWcmaFcANvoY9piRGIDAaZw+eHvZI2VuPHplQa+/T6TE9pGHGyKR8vWI6rr YOAGud7uRnhfp4nHVJO/LsKGLWPwCCrIgelg9PkQ/8544Ayhw+v2qSB6jXn97Se6nz VMJ96sRedtfIw+movvngIAmDNTFT28ixTEQVR7B0= 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 63CA83858C1F for ; Fri, 16 Jun 2023 15:18:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 63CA83858C1F Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-546-nDjQJofZPrC9f5HS-k27cw-1; Fri, 16 Jun 2023 11:18:49 -0400 X-MC-Unique: nDjQJofZPrC9f5HS-k27cw-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-76238aa4b77so59332785a.0 for ; Fri, 16 Jun 2023 08:18:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686928729; x=1689520729; 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=5STi5o3goeE/KvAILw3o0MA1P5q0ERcm7OiISz+DiNA=; b=eORYQXuFBZxKGAJWCdD2kADdnZtFy4EQyhVhQ+NXMHj0itTlbuaShtP6zf/XWu27VQ 4ZOG9gpc0+z0pKnLXUsyMqMyk/lrQfB9Zi9L1q8JtHVi9vpU83zni97CDschb+jVSruV jaLXT6KknvkHyfMe97osNt6lbVq6sdx4GS2lNEDmcwnVo4OnjVyZEkYsTai4LYm6dF1g 95NNPGrbu3+iDrWZ9SYD/Kti1v+nya7ZwP6XMvmGY0v3pnUF3FhWevrqAfiogizrMR9K AGC8FvmvPxvTKmEXnGD/mrDKb7yo9MpeHSnO8dgYhYnsUSCFv1LUEc7pml/4YfDuhmN+ k1vA== X-Gm-Message-State: AC+VfDy63acF0gExksmutJljXhYw1LjZ9QbfluKkwMtopw0Xp8jye+Zs vdiAshexXJh2yIM1RbRA02K9HFpRnDUpt+ogP8qaGaptkiCJ1wdnuU+zI5ptBuK9DjhNiusCPs3 RmtefQmgJq1qo9YkQJQaqEqQDdtHqG9dhJw+CA6okEy5Mc9bvk6wdppEGr3OaxC3gf3wTcRDipQ CZyA== X-Received: by 2002:a05:620a:914:b0:760:7334:2e08 with SMTP id v20-20020a05620a091400b0076073342e08mr2127255qkv.47.1686928728949; Fri, 16 Jun 2023 08:18:48 -0700 (PDT) X-Received: by 2002:a05:620a:914:b0:760:7334:2e08 with SMTP id v20-20020a05620a091400b0076073342e08mr2127233qkv.47.1686928728616; Fri, 16 Jun 2023 08:18:48 -0700 (PDT) Received: from [192.168.1.88] (192-0-143-139.cpe.teksavvy.com. [192.0.143.139]) by smtp.gmail.com with ESMTPSA id c25-20020a05620a165900b00761ff1e23e1sm3031584qko.109.2023.06.16.08.18.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Jun 2023 08:18:47 -0700 (PDT) Message-ID: <7f146c00-3d24-32d9-6de7-e8bdb8128e53@redhat.com> Date: Fri, 16 Jun 2023 11:18:46 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: [pushed] [RA] [PR110215] Ignore conflicts for some pseudos from insns throwing a final exception 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.4 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_H5, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Vladimir Makarov via Gcc-patches From: Vladimir Makarov Reply-To: Vladimir Makarov Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768873038710073663?= X-GMAIL-MSGID: =?utf-8?q?1768873038710073663?= The following patch solves https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110215 The patch was successfully tested and bootstrapped on x86-64, aarch64, and ppc64le. It is difficult to make a stable test for the PR.  So there is not test in the patch. commit 154c69039571c66b3a6d16ecfa9e6ff22942f59f Author: Vladimir N. Makarov Date: Fri Jun 16 11:12:32 2023 -0400 RA: Ignore conflicts for some pseudos from insns throwing a final exception IRA adds conflicts to the pseudos from insns can throw exceptions internally even if the exception code is final for the function and the pseudo value is not used in the exception code. This results in spilling a pseudo in a loop (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110215). The following patch fixes the problem. PR rtl-optimization/110215 gcc/ChangeLog: * ira-lives.cc: Include except.h. (process_bb_node_lives): Ignore conflicts from cleanup exceptions when the pseudo does not live at the exception landing pad. diff --git a/gcc/ira-lives.cc b/gcc/ira-lives.cc index 6a3901ee234..bc8493856a4 100644 --- a/gcc/ira-lives.cc +++ b/gcc/ira-lives.cc @@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see #include "ira-int.h" #include "sparseset.h" #include "function-abi.h" +#include "except.h" /* The code in this file is similar to one in global but the code works on the allocno basis and creates live ranges instead of @@ -1383,14 +1384,24 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node) SET_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj)); SET_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj)); } - if (can_throw_internal (insn)) + 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)))) { - OBJECT_CONFLICT_HARD_REGS (obj) - |= callee_abi.mode_clobbers (ALLOCNO_MODE (a)); - OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) - |= callee_abi.mode_clobbers (ALLOCNO_MODE (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; } - if (sparseset_bit_p (allocnos_processed, num)) continue; sparseset_set_bit (allocnos_processed, num);