From patchwork Wed Nov 14 23:02:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 199091 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]) by ozlabs.org (Postfix) with SMTP id 424682C0079 for ; Thu, 15 Nov 2012 12:13:00 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1353546781; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=qJujGsj6wFtRujSEflhZ NETcGEw=; b=OmIbZrd/TCWRB3Z3cRNsmfDTyv2DUmPB43EljB8atK23fYEmDh6R oll7lfDDk8zcHTPRAXuxuc5sKKCCOaqDm6oBDOZw9d3W57V369eDw6532n0FPv1v FjwHD1BfyXvaIHYBRVTDN0N1vppjEALghrGwqoUi7FGqk6PXdxiFunM= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=xq5iT0te1LYxC5013AQXhWpoR5g9w0kvHItdSdBK8Mqf4/XHntR7YFU5gFXc1q jMhB6QNVW3Lj/XistiXR+A9Ab+tp1G+lDduQCvRAciD+pKtP0aZzfQMNhOutMoGm xjAukef5p+jCHA9wULGSd+TZecj3a4/o5iWmEmsb3/aVg=; Received: (qmail 24374 invoked by alias); 15 Nov 2012 01:12:53 -0000 Received: (qmail 24362 invoked by uid 22791); 15 Nov 2012 01:12:52 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 15 Nov 2012 01:12:40 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAF1CEUb001849 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 14 Nov 2012 20:12:40 -0500 Received: from zalov.redhat.com (vpn1-4-119.ams2.redhat.com [10.36.4.119]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qAEN2U9D031050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 14 Nov 2012 18:02:31 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id qAEN2TGA028010; Thu, 15 Nov 2012 00:02:29 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id qAEN2TI8028009; Thu, 15 Nov 2012 00:02:29 +0100 Date: Thu, 15 Nov 2012 00:02:29 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Cc: Alexandre Oliva , Steven Bosscher Subject: [PATCH] Fix up var-tracking notes emitted in between bbs (PR middle-end/43631) Message-ID: <20121114230229.GN1886@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 Hi! Steven has been complaining for some years that var-tracking inserts NOTE_INSN_VAR_LOCATION (and NOTE_INSN_CALL_ARG_LOCATION) notes sometimes in between basic blocks, but with BLOCK_FOR_INSN set (or sometimes extends a bb ending originally with a noreturn or throwing call by a note or more after it). Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-11-14 Jakub Jelinek PR middle-end/43631 * var-tracking.c (emit_note_insn_var_location, emit_notes_in_bb): Clear BLOCK_FOR_INSN on notes emitted in between basic blocks, don't adjust BB_END when inserting note after BB_END of some bb. Jakub --- gcc/var-tracking.c.jj 2012-11-13 10:54:06.000000000 +0100 +++ gcc/var-tracking.c 2012-11-13 11:35:31.668284140 +0100 @@ -8566,9 +8566,30 @@ emit_note_insn_var_location (void **varp || NOTE_KIND (insn) == NOTE_INSN_CALL_ARG_LOCATION)) note = emit_note_after (NOTE_INSN_VAR_LOCATION, insn); else - note = emit_note_before (NOTE_INSN_VAR_LOCATION, insn); + { + note = emit_note_before (NOTE_INSN_VAR_LOCATION, insn); + /* If insn is BB_HEAD of some bb, make sure the note + doesn't have BLOCK_FOR_INSN set. The notes don't + extend the extents of a basic block, and e.g. notes emitted + for differences in between basic blocks should live in between + the basic blocks. */ + if (BLOCK_FOR_INSN (note) + && BB_HEAD (BLOCK_FOR_INSN (note)) == insn) + set_block_for_insn (note, NULL); + } } NOTE_VAR_LOCATION (note) = note_vl; + /* If insn is BB_END of some bb, make sure the note + doesn't have BLOCK_FOR_INSN set. The notes don't + extend the extents of a basic block, and e.g. a noreturn + call can still be followed by NOTE_INSN_CALL_ARG_LOCATION. */ + if (BLOCK_FOR_INSN (note) + && BB_END (BLOCK_FOR_INSN (note)) == note + && PREV_INSN (note) == insn) + { + BB_END (BLOCK_FOR_INSN (note)) = insn; + set_block_for_insn (note, NULL); + } set_dv_changed (var->dv, false); gcc_assert (var->in_changed_variables); @@ -8936,6 +8957,16 @@ emit_notes_in_bb (basic_block bb, datafl } note = emit_note_after (NOTE_INSN_CALL_ARG_LOCATION, insn); NOTE_VAR_LOCATION (note) = arguments; + /* If insn is BB_END of some bb, make sure the note + doesn't have BLOCK_FOR_INSN set. The notes don't + extend the extents of a basic block, and e.g. a noreturn + call can still be followed by NOTE_INSN_CALL_ARG_LOCATION. */ + if (BLOCK_FOR_INSN (note) + && BB_END (BLOCK_FOR_INSN (note)) == note) + { + BB_END (BLOCK_FOR_INSN (note)) = insn; + set_block_for_insn (note, NULL); + } } break;