From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21248 invoked by alias); 12 Apr 2011 17:09:02 -0000 Received: (qmail 21236 invoked by uid 22791); 12 Apr 2011 17:09:01 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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; Tue, 12 Apr 2011 17:08:50 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3CH8RQH003094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Apr 2011 13:08:28 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3CH8Q9H006393 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Apr 2011 13:08:27 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p3CH8QMj014132; Tue, 12 Apr 2011 19:08:26 +0200 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p3CH8Q4g014131; Tue, 12 Apr 2011 19:08:26 +0200 Date: Tue, 12 Apr 2011 17:09:00 -0000 From: Jakub Jelinek To: Eric Botcazou Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Don't update_cfg_for_uncondjump for noop non-jump moves Message-ID: <20110412170826.GG17079@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek References: <20110411104958.GY17079@tyan-ft48-01.lab.bos.redhat.com> <201104120918.01366.ebotcazou@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201104120918.01366.ebotcazou@adacore.com> 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg00909.txt.bz2 On Tue, Apr 12, 2011 at 09:18:01AM +0200, Eric Botcazou wrote: > > The propagate_for_debug change alone could fix it, we should never > > fall through into next basic block. We are unforuntately not deleting > > just jumps (which ought to appear at the end of bbs), but also > > any other noop moves, which I think is unintentional, we have > > delete_noop_moves that should clean that up instead (see the second patch). > > Yes, I wondered several times about that. This clearly looks unintentional and > I agree that it is worth fixing on the mainline, adding gcc_assert (at_end); to > update_cfg_for_uncondjump in the process. Here is a patch, bootstrapped/regtested on x86_64-linux and i686-linux. Ok for trunk? 2011-04-12 Jakub Jelinek * combine.c (update_cfg_for_uncondjump): Instead of testing at_end assert it is always true. (try_combine): Don't call update_cfg_for_uncondjump for noop non-jump moves. --- gcc/combine.c.jj 2011-04-12 12:52:11.963669819 +0200 +++ gcc/combine.c 2011-04-12 16:31:57.059671430 +0200 @@ -2490,13 +2490,12 @@ static void update_cfg_for_uncondjump (rtx insn) { basic_block bb = BLOCK_FOR_INSN (insn); - bool at_end = (BB_END (bb) == insn); + gcc_assert (BB_END (bb) == insn); - if (at_end) - purge_dead_edges (bb); + purge_dead_edges (bb); delete_insn (insn); - if (at_end && EDGE_COUNT (bb->succs) == 1) + if (EDGE_COUNT (bb->succs) == 1) { rtx insn; @@ -4409,7 +4408,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx /* A noop might also need cleaning up of CFG, if it comes from the simplification of a jump. */ - if (GET_CODE (newpat) == SET + if (JUMP_P (i3) + && GET_CODE (newpat) == SET && SET_SRC (newpat) == pc_rtx && SET_DEST (newpat) == pc_rtx) { @@ -4418,6 +4418,7 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx } if (undobuf.other_insn != NULL_RTX + && JUMP_P (undobuf.other_insn) && GET_CODE (PATTERN (undobuf.other_insn)) == SET && SET_SRC (PATTERN (undobuf.other_insn)) == pc_rtx && SET_DEST (PATTERN (undobuf.other_insn)) == pc_rtx) Jakub