From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18045 invoked by alias); 27 Feb 2012 13:04:30 -0000 Received: (qmail 18034 invoked by uid 22791); 27 Feb 2012 13:04:29 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Feb 2012 13:04:16 +0000 From: "abel at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/52250] [4.7 Regression] ICE: in sel_remove_bb, at sel-sched-ir.c:5213 with -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -fselective-scheduling2 and other flags Date: Mon, 27 Feb 2012 13:05:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: abel at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-02/txt/msg02573.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52250 --- Comment #5 from Andrey Belevantsev 2012-02-27 13:03:58 UTC --- When removing an empty block, we need to find its neighbour to stick the bb note list to, and the code doing this now just picks some pred block from the loop that redirects preds' edges around the block being removed. Which happens to be the wrong one for the test case. Fixed by making the logic properly consider preds and the only succ, if needed, as below. I will test this tomorrow and still can make it before the RC1, I think. diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index a93cd68..03d135f 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -3658,7 +3658,7 @@ sel_recompute_toporder (void) static bool maybe_tidy_empty_bb (basic_block bb) { - basic_block succ_bb, pred_bb; + basic_block succ_bb, pred_bb, note_bb; VEC (basic_block, heap) *dom_bbs; edge e; edge_iterator ei; @@ -3697,6 +3697,17 @@ maybe_tidy_empty_bb (basic_block bb) pred_bb = NULL; dom_bbs = NULL; + /* Save a pred/succ from the current region to attach the notes to. */ + note_bb = NULL; + FOR_EACH_EDGE (e, ei, bb->preds) + if (in_current_region_p (e->src)) + { + note_bb = e->src; + break; + } + if (note_bb == NULL) + note_bb = succ_bb; + /* Redirect all non-fallthru edges to the next bb. */ while (rescan_p) { @@ -3746,10 +3757,8 @@ maybe_tidy_empty_bb (basic_block bb) else { /* This is a block without fallthru predecessor. Just delete it. */ - gcc_assert (pred_bb != NULL); - - if (in_current_region_p (pred_bb)) - move_bb_info (pred_bb, bb); + gcc_assert (note_bb); + move_bb_info (note_bb, bb); remove_empty_bb (bb, true); }