From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7354 invoked by alias); 12 May 2014 10:28:54 -0000 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 Received: (qmail 7308 invoked by uid 48); 12 May 2014 10:28:50 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/61058] [4.7/4.8/4.9/4.10 Regression] ICE: RTL check: expected elt 3 type 'B', have '0' (rtx barrier) in distance_agu_use_in_bb, at config/i386/i386.c:16740 with __builtin_unreachable() Date: Mon, 12 May 2014 10:28: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-Version: 4.10.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-05/txt/msg00997.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61058 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #6 from Jakub Jelinek --- I think the buggy pass here is: static unsigned int cleanup_barriers (void) { rtx insn, next, prev; for (insn = get_insns (); insn; insn = next) { next = NEXT_INSN (insn); if (BARRIER_P (insn)) { prev = prev_nonnote_insn (insn); if (!prev) continue; if (BARRIER_P (prev)) delete_insn (insn); else if (prev != PREV_INSN (insn)) reorder_insns_nobb (insn, insn, prev); } } return 0; } At the start of that pass we have: (note 3 1 9 2 [bb 2] NOTE_INSN_BASIC_BLOCK) (insn/f 9 3 10 2 (set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0 S8 A8]) (reg/f:DI 6 bp)) pr61058.c:3 -1 (nil)) (insn/f 10 9 11 2 (set (reg/f:DI 6 bp) (reg/f:DI 7 sp)) pr61058.c:3 -1 (nil)) (note 11 10 2 2 NOTE_INSN_PROLOGUE_END) (note 2 11 5 2 NOTE_INSN_FUNCTION_BEG) (barrier 5 2 8) (note 8 5 0 NOTE_INSN_DELETED) where BB_HEAD (bb2) is note 3 and BB_END (bb2) is note 2, note 8 has been added by LRA (but reload does that too AFAIK), both barrier and note are outside of the bb 2. Now, the above reorders the barrier after insn 10, making it part of bb2 because BB_END (bb2) isn't adjusted. So, either cleanup_barriers should not move anything here (e.g. because prev doesn't satisfy control_flow_insn_p (prev)), and/or, of it decides to move something, it has to take care of adjusting the affected basic blocks (but how? Would we keep the two notes (11 and 2) without basic block). Do we need the cleanup_barriers pass at all these days?