From patchwork Tue Jun 28 11:11:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 55480 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 06D5238EA158 for ; Tue, 28 Jun 2022 14:24:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 06D5238EA158 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1656426242; bh=bXCQWSFFmLL2GCpJKxjQ1oA5hXVA+kbcfn4wWtNY8Ec=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=hK0Q8XDDqhWynB3dNSKMzh20lZa7x8gCJkj6Zz4dT6w7vHWX4M4RGO8BGLp7RdBjn Dkh9XYqd/DjtffZLTdEy5PLS2gtGAo6PYUqsM1jj5NpT2ZyeQdJClfRsLtBbKDGU4w +8ft6PZgOPx3U3xMv6PPJ3BQkclLV7MkToIjBIvc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id D873F383379F for ; Tue, 28 Jun 2022 11:11:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D873F383379F Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id A163C21A73; Tue, 28 Jun 2022 11:11:55 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 76CF02C141; Tue, 28 Jun 2022 11:11:55 +0000 (UTC) Date: Tue, 28 Jun 2022 11:11:55 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] rtl-optimization/106082 - preserve EH note for no non-local goto User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, SPF_PASS, 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: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Cc: segher@kernel.crashing.org Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Message-Id: <20220628142402.06D5238EA158@sourceware.org> The following makes sure we preserve EH notes on call insns that indicate the call doesn't perform a non-local goto when distributing notes after combining insns. Bootstrap & regtest pending on x86_64-unknown-linux-gnu, tested on the m68k testcase in the PR. OK for trunk if testing passes? Thanks, Richard. 2022-06-28 Richard Biener PR rtl-optimization/106082 * combine.cc (distribute_notes): Preserve notes when they indicate a call doesn't perform a non-local goto. --- gcc/combine.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/combine.cc b/gcc/combine.cc index a8305273e44..3d34e860cf9 100644 --- a/gcc/combine.cc +++ b/gcc/combine.cc @@ -14218,8 +14218,10 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2, gcc_assert (from_insn == i3); /* We are making sure there is a single effective REG_EH_REGION note and it's valid to put it on i3. */ - if (!insn_could_throw_p (from_insn)) - /* Throw away stra notes on insns that can never throw. */ + if (!insn_could_throw_p (from_insn) + && (lp_nr != INT_MIN || !can_nonlocal_goto (from_insn))) + /* Throw away stray notes on insns that can never throw or + make a nonlocal goto. */ ; else {