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: 1649561 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Rn84gtGb; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LXRfm5hp9z9sFx for ; Wed, 29 Jun 2022 00:23:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D035E38890F0 for ; Tue, 28 Jun 2022 14:23:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D035E38890F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1656426232; 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=Rn84gtGb1jh1EowPgE0MLe3aq7O6WpugyTTUQsEAoXCFVm1M74AtB1l7AN38WOOxV sAtTASRpvqlnpE4NrBIYaDgD6Va24465ektW5VkgFMAJxkrOhVsbyQnXV33a7v6ETn ic5ccJ1QepNsMxGpMuI0ReenpQK4GFB2LzZ2vau8= 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Message-Id: <20220628142352.D035E38890F0@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 {