From patchwork Sun Jan 30 03:13:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 80995 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 D69FE1007D1 for ; Sun, 30 Jan 2011 14:13:39 +1100 (EST) Received: (qmail 20375 invoked by alias); 30 Jan 2011 03:13:36 -0000 Received: (qmail 20366 invoked by uid 22791); 30 Jan 2011 03:13:34 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, MSGID_FROM_MTA_HEADER, SPF_SOFTFAIL, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate4.uk.ibm.com (HELO mtagate4.uk.ibm.com) (194.196.100.164) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 30 Jan 2011 03:13:27 +0000 Received: from d06nrmr1507.portsmouth.uk.ibm.com (d06nrmr1507.portsmouth.uk.ibm.com [9.149.38.233]) by mtagate4.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p0U3DPYt005968 for ; Sun, 30 Jan 2011 03:13:25 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p0U3DRR61753210 for ; Sun, 30 Jan 2011 03:13:27 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p0U3DOxO007548 for ; Sat, 29 Jan 2011 20:13:24 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p0U3DNJ0007545; Sat, 29 Jan 2011 20:13:23 -0700 Message-Id: <201101300313.p0U3DNJ0007545@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Sun, 30 Jan 2011 04:13:23 +0100 Subject: Re: [PR debug/45136] revamp handling of BB boundary debug insns in sched To: aoliva@redhat.com (Alexandre Oliva) Date: Sun, 30 Jan 2011 04:13:23 +0100 (CET) From: "Ulrich Weigand" Cc: gcc-patches@gcc.gnu.org, rth@redhat.com In-Reply-To: from "Alexandre Oliva" at Jan 19, 2011 08:26:48 PM MIME-Version: 1.0 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 Alexandre Oliva wrote: > PR debug/45136 > PR debug/45130 > * haifa-sched.c (get_ebb_head_tail): Move notes across boundary > debug insns. > (no_real_insns_p, schedule_block, set_priorities): Drop special > treatment of boundary debug insns. > * sched-deps.c (sd_init_insn, sd_finish_insn): Don't mark debug > insns. > * sched-ebb.c (schedule_ebbs): Don't skip debug insns. > * sched-int.h (DEBUG_INSN_SCHED_P): Remove. > (BOUNDARY_DEBUG_INSN_P): Likewise. > (SCHEDULE_DEBUG_INSN_P): Likewise. > * sched-rgn.c (init_ready_list): Drop special treatment of > boundary debug insns. > * final.c (rest_of_clean-state): Clear notes' BB. This seems to have caused a regression on SPU: FAIL: gcc.dg/pr42918.c (test for excess errors) The problem is that a note is moved to someplace else after it was moved to a different basic block in get_ebb_head_tail: Before sched1, the note is here: (note 23 22 24 5 [bb 5] NOTE_INSN_BASIC_BLOCK) (call_insn 24 23 25 5 (parallel [ (call (mem:QI (symbol_ref:SI ("fv") [flags 0x41] ) [0 S1 A8]) (const_int 0 [0])) (clobber (reg:SI 0 $lr)) (clobber (reg:SI 130 hbr)) ]) /home/uweigand/fsf/gcc-head/gcc/testsuite/gcc.dg/pr42918.c:18 419 {_call} (nil) (nil)) (note 25 24 30 5 ("lab") NOTE_INSN_DELETED_LABEL 3) ;; End of basic block 5 -> ( 6) ;; lr out 1 [$sp] 127 [$127] 128 [$vfp] 129 [$vap] 140 ;; live out 1 [$sp] 127 [$127] 128 [$vfp] 129 [$vap] 140 Without debug info, it stays here after sched1. *With* debug info, we also have a debug_insn: (note 25 24 26 5 [bb 5] NOTE_INSN_BASIC_BLOCK) (call_insn 26 25 27 5 (parallel [ (call (mem:QI (symbol_ref:SI ("fv") [flags 0x41] ) [0 S1 A8]) (const_int 0 [0])) (clobber (reg:SI 0 $lr)) (clobber (reg:SI 130 hbr)) ]) /home/uweigand/fsf/gcc-head/gcc/testsuite/gcc.dg/pr42918.c:18 419 {_call} (nil) (nil)) (note 27 26 29 5 ("lab") NOTE_INSN_DELETED_LABEL 3) (debug_insn 29 27 33 5 (var_location:SI i (reg/v:SI 140 [ i ])) -1 (nil)) ;; End of basic block 5 -> ( 6) ;; lr out 1 [$sp] 127 [$127] 128 [$vfp] 129 [$vap] 140 ;; live out 1 [$sp] 127 [$127] 128 [$vfp] 129 [$vap] 140 The new code in get_ebb_head_tail now moves the note into another basic block: (call_insn 26 25 29 5 (parallel [ (call (mem:QI (symbol_ref:SI ("fv") [flags 0x41] ) [0 S1 A8]) (const_int 0 [0])) (clobber (reg:SI 0 $lr)) (clobber (reg:SI 130 hbr)) ]) /home/uweigand/fsf/gcc-head/gcc/testsuite/gcc.dg/pr42918.c:18 419 {_call} (nil) (nil)) (debug_insn 29 26 27 5 (var_location:SI i (reg/v:SI 140 [ i ])) -1 (nil)) ;; End of basic block 5 -> ( 6) ;; lr out 1 [$sp] 127 [$127] 128 [$vfp] 129 [$vap] 140 ;; live out 1 [$sp] 127 [$127] 128 [$vfp] 129 [$vap] 140 ;; Succ edge 6 [100.0%] (fallthru) (note 27 29 33 ("lab") NOTE_INSN_DELETED_LABEL 3) After basic block reordering and various other optimizations, this means the note ends up in a completely different location in the final output. The move into a different block occurs here: while (end_head != end_tail) if (NOTE_P (end_tail)) end_tail = PREV_INSN (end_tail); else if (DEBUG_INSN_P (end_tail)) { rtx note, prev; for (note = PREV_INSN (end_tail); note != end_head; note = prev) { prev = PREV_INSN (note); if (NOTE_P (note)) { if (sched_verbose >= 9) fprintf (sched_dump, "reorder %i\n", INSN_UID (note)); reorder_insns_nobb (note, note, end_tail); if (end_tail == BB_END (end)) df_insn_change_bb (note, NULL); Why is this df_insn_change_bb call necessary? Bye, Ulrich --- pr42918.gkd 2011-01-30 03:31:48.000000000 +0100 +++ pr42918.gk.gkd 2011-01-30 04:05:07.000000000 +0100 @@ -100,6 +100,7 @@ (expr_list:REG_BR_PROB (const_int 1990 [0x7c6]) (nil))) -> 5) +(note# 0 0 ("lab") NOTE_INSN_DELETED_LABEL 3) (note# 0 0 [bb 4] NOTE_INSN_BASIC_BLOCK) (insn# 0 0 (use (reg/i:SI 3 $3)) /home/uweigand/fsf/gcc-head/gcc/testsuite/gcc.dg/pr42918.c:21# (nil)) @@ -124,7 +125,6 @@ (barrier 0 0 0) (code_label 5 0 0 5 "" [2 uses]) (note# 0 0 [bb 5] NOTE_INSN_BASIC_BLOCK) -(note# 0 0 ("lab") NOTE_INSN_DELETED_LABEL 3) (insn:TI# 0 0 (set (mem/c:TI (plus:SI (reg/f:SI 1 $sp) (const_int 32 [0x20])) [ S16 A128]) (reg:TI 3 $3)) /home/uweigand/fsf/gcc-head/gcc/testsuite/gcc.dg/pr42918.c:18# {_movti}