From patchwork Mon Feb 25 11:31:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 222910 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 3FC732C0091 for ; Mon, 25 Feb 2013 22:31:31 +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=1362396692; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC: Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=iy82QqcjuSFDj1QnlzlFjwQzJ6E=; b=e5e3iOf1AaVLLwJ D8freTNuoafLz9N8SFGdb/fXfXFBE3BxqtjHri6uQpstC7a/z1tdmnKHnfbZlGFy fkHQGyyveW3r4lTTLDZopsXHGqIPVb4NFe55ApAzrdn1El6y+mbHL4GuSOVCVrME Eo5m6esJ892E9T93MnIWMIwfmjPY= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=cyO9ZGGCO9FJZmbMmqURHu4yYRPCSF8X+g9f4P92NJNsvu6I2JB7TUciC40vCC MPIeWmm8qftXiM2KSc4HW4P0OuBY3r8bl0LnPh0Y2wotDGjY9ZzePpsS+skHd3TR YIZWW3bOZJHIo+wpRywSWPQaFrmPHZKZMOqRfsk4tg58I=; Received: (qmail 24692 invoked by alias); 25 Feb 2013 11:31:26 -0000 Received: (qmail 24683 invoked by uid 22791); 25 Feb 2013 11:31:25 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 25 Feb 2013 11:31:19 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1U9wH6-0004zn-Mm from Tom_deVries@mentor.com ; Mon, 25 Feb 2013 03:31:16 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 25 Feb 2013 03:31:16 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.1.289.1; Mon, 25 Feb 2013 11:31:14 +0000 Message-ID: <512B4B7B.7090907@mentor.com> Date: Mon, 25 Feb 2013 12:31:07 +0100 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: Jakub Jelinek CC: "gcc-patches@gcc.gnu.org" , Steven Bosscher , Eric Botcazou , Subject: [PATCH] Fix PR56131 - Don't reorder DELETED_LABEL and BASIC_BLOCK notes without CFG 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 Jakub, attached patch fixes (or rather, fixes up the previous fix for) PR56131. The patch makes sure that we don't try to reorder DELETED_LABEL and BASIC_BLOCK NOTE_INSNs when there is no CFG. The patch will prevent PR56242 from triggering on hppa, In addition, the patch adds a comment in insn-notes.def about when NOTE_INSN_BASIC_BLOCK cannot be expected to be reliable. Bootstrapped and reg-tested on x86_64. OK for trunk? Thanks, - Tom 2013-02-25 Tom de Vries PR rtl-optimization/56131 * insn-notes.def (INSN_NOTE_BASIC_BLOCK): Update comment. * cfgrtl.c (delete_insn): Don't reorder NOTE_INSN_DELETED_LABEL and NOTE_INSN_BASIC_BLOCK if BLOCK_FOR_INSN == NULL. Index: gcc/insn-notes.def =================================================================== --- gcc/insn-notes.def (revision 195874) +++ gcc/insn-notes.def (working copy) @@ -70,7 +70,9 @@ INSN_NOTE (CALL_ARG_LOCATION) /* Record the struct for the following basic block. Uses NOTE_BASIC_BLOCK. FIXME: Redundant with the basic block pointer - now included in every insn. */ + now included in every insn. NOTE: If there's no CFG anymore, in other words, + if BLOCK_FOR_INSN () == NULL, NOTE_BASIC_BLOCK cannot be considered reliable + anymore. */ INSN_NOTE (BASIC_BLOCK) /* Mark the inflection point in the instruction stream where we switch Index: gcc/cfgrtl.c =================================================================== --- gcc/cfgrtl.c (revision 195874) +++ gcc/cfgrtl.c (working copy) @@ -135,7 +135,7 @@ delete_insn (rtx insn) if (! can_delete_label_p (insn)) { const char *name = LABEL_NAME (insn); - basic_block bb, label_bb = BLOCK_FOR_INSN (insn); + basic_block bb = BLOCK_FOR_INSN (insn); rtx bb_note = NEXT_INSN (insn); really_delete = false; @@ -144,15 +144,13 @@ delete_insn (rtx insn) NOTE_DELETED_LABEL_NAME (insn) = name; /* If the note following the label starts a basic block, and the - label is a member of the same basic block, interchange the two. - If the label is not marked with a bb, assume it's the same bb. */ + label is a member of the same basic block, interchange the two. */ if (bb_note != NULL_RTX && NOTE_INSN_BASIC_BLOCK_P (bb_note) - && (label_bb == NOTE_BASIC_BLOCK (bb_note) - || label_bb == NULL)) + && bb != NULL + && bb == BLOCK_FOR_INSN (bb_note)) { reorder_insns_nobb (insn, insn, bb_note); - bb = NOTE_BASIC_BLOCK (bb_note); BB_HEAD (bb) = bb_note; if (BB_END (bb) == bb_note) BB_END (bb) = insn;