public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "spark at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/34171] [4.3 Regression] Segfault in df_chain_remove_problem with -O3 on alpha Date: Thu, 22 Nov 2007 00:30:00 -0000 [thread overview] Message-ID: <20071122003012.13139.qmail@sourceware.org> (raw) In-Reply-To: <bug-34171-12387@http.gcc.gnu.org/bugzilla/> ------- Comment #16 from spark at gcc dot gnu dot org 2007-11-22 00:30 ------- I'm bootstrapping the following patch. This includes some slight refactoring of set_block_for_insn/df_insn_change_bb loops within cfgrtl.c. It's mostly cosmetic change on top of the patch on comment #15. diff -r fad6feb87420 gcc/cfgrtl.c --- a/gcc/cfgrtl.c Wed Nov 21 00:17:50 2007 +0000 +++ b/gcc/cfgrtl.c Wed Nov 21 23:48:55 2007 +0000 @@ -465,23 +465,48 @@ emit_insn_at_entry (rtx insn) commit_edge_insertions (); } -/* Update insns block within BB. */ +/* Update BLOCK_FOR_INSN of insns between BEGIN and END + including BEGIN but not END, and notify df of the change. + Note that NEXT_INSN (END) has to have a valid value + (either NULL or a pointer to a valid insn). */ + +static void +update_bb_for_insns (rtx begin, rtx end, basic_block bb) +{ + rtx insn; + + for (insn = begin; insn != end; insn = NEXT_INSN (insn)) + { + if (!BARRIER_P (insn)) + { + set_block_for_insn (insn, bb); + df_insn_change_bb (insn); + } + } +} + +/* Call df_insn_change_bb for insns between BEGIN and END + including BEGIN but not END. + Note that NEXT_INSN (END) has to have a valid value + (either NULL or a pointer to a valid insn). */ + +static void +notify_bb_change_for_insns (rtx begin, rtx end) +{ + rtx insn; + + for (insn = begin; insn != end; insn = NEXT_INSN (insn)) + if (!BARRIER_P (insn)) + df_insn_change_bb (insn); +} + +/* Update BLOCK_FOR_INSN of insns in BB to BB, + and notify df of the change. */ void update_bb_for_insn (basic_block bb) { - rtx insn; - - for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn)) - { - if (!BARRIER_P (insn)) - { - set_block_for_insn (insn, bb); - df_insn_change_bb (insn); - } - if (insn == BB_END (bb)) - break; - } + update_bb_for_insns (BB_HEAD (bb), NEXT_INSN (BB_END (bb)), bb); } /* Return the INSN immediately following the NOTE_INSN_BASIC_BLOCK @@ -629,16 +654,7 @@ rtl_merge_blocks (basic_block a, basic_b /* Reassociate the insns of B with A. */ if (!b_empty) { - rtx x; - - for (x = a_end; x != b_end; x = NEXT_INSN (x)) - { - set_block_for_insn (x, a); - df_insn_change_bb (x); - } - - set_block_for_insn (b_end, a); - df_insn_change_bb (b_end); + update_bb_for_insns (a_end, NEXT_INSN (b_end), a); a_end = b_end; } @@ -843,14 +859,9 @@ try_redirect_by_replacing_jump (edge e, which originally were or were created before jump table are inside the basic block. */ rtx new_insn = BB_END (src); - rtx tmp; - - for (tmp = NEXT_INSN (BB_END (src)); tmp != barrier; - tmp = NEXT_INSN (tmp)) - { - set_block_for_insn (tmp, src); - df_insn_change_bb (tmp); - } + + update_bb_for_insns (NEXT_INSN (BB_END (src)), + barrier, src); NEXT_INSN (PREV_INSN (new_insn)) = NEXT_INSN (new_insn); PREV_INSN (NEXT_INSN (new_insn)) = PREV_INSN (new_insn); @@ -2637,6 +2648,12 @@ cfg_layout_merge_blocks (basic_block a, first = NEXT_INSN (first); gcc_assert (NOTE_INSN_BASIC_BLOCK_P (first)); BB_HEAD (b) = NULL; + + /* emit_insn_after_noloc doesn't call df_insn_change_bb. + We need to explicitly notify. */ + notify_bb_change_for_insns (NEXT_INSN (first), + NEXT_INSN (BB_END (b))); + delete_insn (first); } /* Otherwise just re-associate the instructions. */ @@ -2644,13 +2661,8 @@ cfg_layout_merge_blocks (basic_block a, { rtx insn; - for (insn = BB_HEAD (b); - insn != NEXT_INSN (BB_END (b)); - insn = NEXT_INSN (insn)) - { - set_block_for_insn (insn, a); - df_insn_change_bb (insn); - } + update_bb_for_insns (BB_HEAD (b), + NEXT_INSN (BB_END (b)), a); insn = BB_HEAD (b); /* Skip possible DELETED_LABEL insn. */ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34171
next prev parent reply other threads:[~2007-11-22 0:30 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-11-21 9:18 [Bug rtl-optimization/34171] New: " tbm at cyrius dot com 2007-11-21 9:19 ` [Bug rtl-optimization/34171] " tbm at cyrius dot com 2007-11-21 9:20 ` tbm at cyrius dot com 2007-11-21 9:20 ` tbm at cyrius dot com 2007-11-21 9:47 ` bonzini at gnu dot org 2007-11-21 10:56 ` tbm at cyrius dot com 2007-11-21 12:52 ` paolo dot bonzini at lu dot unisi dot ch 2007-11-21 16:22 ` spark at gcc dot gnu dot org 2007-11-21 17:47 ` steven at gcc dot gnu dot org 2007-11-21 18:11 ` tbm at cyrius dot com 2007-11-21 20:03 ` steven at gcc dot gnu dot org 2007-11-21 20:23 ` tbm at cyrius dot com 2007-11-21 20:41 ` spark at gcc dot gnu dot org 2007-11-21 22:09 ` spark at gcc dot gnu dot org 2007-11-21 22:30 ` steven at gcc dot gnu dot org 2007-11-21 22:43 ` spark at gcc dot gnu dot org 2007-11-22 0:30 ` spark at gcc dot gnu dot org [this message] 2007-11-22 7:06 ` steven at gcc dot gnu dot org 2007-11-25 2:47 ` pinskia at gcc dot gnu dot org 2007-11-27 22:25 ` mmitchel at gcc dot gnu dot org 2007-11-30 17:03 ` spark at gcc dot gnu dot org 2007-11-30 17:07 ` jakub at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20071122003012.13139.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).