From: Jeffrey A Law Date: Thu, 18 Nov 1999 06:45:55 +0000 (+0000) Subject: flow.c (split_edge): Take looping structure into account when determining where to... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9aa137f325e3e8b3f790094cc0f31476aad9217e;p=gcc.git flow.c (split_edge): Take looping structure into account when determining where to put the new block... * flow.c (split_edge): Take looping structure into account when determining where to put the new block note. From-SVN: r30567 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d3668cecb6a..baa083cb1ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Wed Nov 17 23:46:14 1999 Jeffrey A Law (law@cygnus.com) + + * flow.c (split_edge): Take looping structure into account when + determining where to put the new block note. + Wed Nov 17 20:42:43 1999 Jeff Holcomb * Makefile.in (ggc-none.o): Provide host specific version if diff --git a/gcc/flow.c b/gcc/flow.c index fee2f551fc6..83783722288 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -1422,8 +1422,31 @@ split_edge (edge_in) BASIC_BLOCK (i) = bb; bb->index = i; - /* Create the basic block note. */ - if (old_succ != EXIT_BLOCK_PTR) + /* Create the basic block note. + + Where we place the note can have a noticable impact on the generated + code. Consider this cfg: + + + E + | + 0 + / \ + +->1-->2--->E + | | + +--+ + + If we need to insert an insn on the edge from block 0 to block 1, + we want to ensure the instructions we insert are outside of any + loop notes that physically sit between block 0 and block 1. Otherwise + we confuse the loop optimizer into thinking the loop is a phony. */ + if (old_succ != EXIT_BLOCK_PTR + && PREV_INSN (old_succ->head) + && GET_CODE (PREV_INSN (old_succ->head)) == NOTE + && NOTE_LINE_NUMBER (PREV_INSN (old_succ->head)) == NOTE_INSN_LOOP_BEG) + bb_note = emit_note_before (NOTE_INSN_BASIC_BLOCK, + PREV_INSN (old_succ->head)); + else if (old_succ != EXIT_BLOCK_PTR) bb_note = emit_note_before (NOTE_INSN_BASIC_BLOCK, old_succ->head); else bb_note = emit_note_after (NOTE_INSN_BASIC_BLOCK, get_last_insn ());