From patchwork Fri Feb 19 15:08:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 585247 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 AF4FA14033E for ; Sat, 20 Feb 2016 02:08:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=SHmt7/4E; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=ch0DFwGBz+uV2+8aEXQpSx2fE1u69 xToiwLi19smbTDBQgnyXZuec7XMqp8T5lUzrWM3KzjYjDQ6CAN8UEaagdYZ1aWKa vyoEYvTaWaDWHE/PJ8LPvp5F3phOEr4wMhIruJeiDgMV8fpFhlVi1I/cvhXFpk92 MhSsXLB3SSqaIE= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=WK+qUOc3YgSp/KXPvqRT84W+d7s=; b=SHm t7/4Es7MhsRnYeXLPX2wNPq0mnYaJ5czu7DVLHBjN4QYncudUzY8YDzv8/yCgJhB egIEDBbMX0FSOkt7eo/CLYtFz64XZEG55PGgoUMOpEF7PPQVD23P12f1tf/zj2Yg FIzdTmepocANIFY9lrrHCmrsbEpEGYD8c018n4tk= Received: (qmail 8379 invoked by alias); 19 Feb 2016 15:08:46 -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 8369 invoked by uid 89); 19 Feb 2016 15:08:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=*loc, remove_note, H*Ad:U*vogt, kindly X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 19 Feb 2016 15:08:44 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id C3BBE627C5; Fri, 19 Feb 2016 15:08:42 +0000 (UTC) Received: from tucnak.zalov.cz ([10.3.113.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1JF8fbx020665 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 19 Feb 2016 10:08:42 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u1JF8cR5002450; Fri, 19 Feb 2016 16:08:39 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u1JF8bCG002449; Fri, 19 Feb 2016 16:08:37 +0100 Date: Fri, 19 Feb 2016 16:08:37 +0100 From: Jakub Jelinek To: Vladimir Makarov Cc: gcc-patches@gcc.gnu.org, Dominik Vogt Subject: [PATCH] Fix up handling of REG_EH_REGION notes in LRA (PR middle-end/69838) Message-ID: <20160219150837.GO3017@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Hi! For -fnon-call-exceptions, if an instruction with REG_EH_REGION note is reloaded, we should copy or move it to the instruction(s) corresponding to the original one that could throw. reload1.c apparently does this, but LRA does not, so we can end up with REG_EH_REGION notes being dropped, or not present on insns that actually can throw etc. Fixed by calling the functions reload1.c does for this purpose. Bootstrapped/regtested on x86_64-linux (including Ada) and i686-linux (without Ada), and Dominik has kindly tested this on s390x-linux (presumably with Ada, but don't know for sure). Ok for trunk? 2016-02-19 Jakub Jelinek PR middle-end/69838 * lra.c (lra_process_new_insns): If non-call exceptions are enabled, call copy_reg_eh_region_note_forward on before and/or after sequences and remove note from insn if it no longer can throw. Jakub --- gcc/lra.c.jj 2016-01-04 14:55:52.000000000 +0100 +++ gcc/lra.c 2016-02-19 12:01:49.747724404 +0100 @@ -1742,20 +1742,29 @@ lra_process_new_insns (rtx_insn *insn, r } if (before != NULL_RTX) { + if (cfun->can_throw_non_call_exceptions) + copy_reg_eh_region_note_forward (insn, before, NULL); emit_insn_before (before, insn); push_insns (PREV_INSN (insn), PREV_INSN (before)); setup_sp_offset (before, PREV_INSN (insn)); } if (after != NULL_RTX) { + if (cfun->can_throw_non_call_exceptions) + copy_reg_eh_region_note_forward (insn, after, NULL); for (last = after; NEXT_INSN (last) != NULL_RTX; last = NEXT_INSN (last)) ; emit_insn_after (after, insn); push_insns (last, insn); setup_sp_offset (after, last); } + if (cfun->can_throw_non_call_exceptions) + { + rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX); + if (note && !insn_could_throw_p (insn)) + remove_note (insn, note); + } } - /* Replace all references to register OLD_REGNO in *LOC with pseudo