diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-26 20:36:01 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-26 20:36:01 +0000 |
commit | fb3c15bc09a56a212a1a57e6e971b59a75884c72 (patch) | |
tree | 4d6e8197e32e92b663df66e7f3d07be1ccf41202 /gcc/flow.c | |
parent | 4d2ad65d3035af9eecbf84746415eae0d696a296 (diff) | |
download | gcc-fb3c15bc09a56a212a1a57e6e971b59a75884c72.tar.gz |
* rtl.h (cleanup_barriers): Declare.
* jump.c (cleanup_barriers): New function.
* toplev.c (rest_of_compilation): Call cleanup_barriers
before loop optimizer and after bb_reorder.
* flow.c (back_edge_of_syntactic_loop_p): New.
(split_edge): Use it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44409 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/flow.c')
-rw-r--r-- | gcc/flow.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/gcc/flow.c b/gcc/flow.c index cd33decb7cf..248d4296fb4 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -482,6 +482,7 @@ static void flow_loops_tree_build PARAMS ((struct loops *)); static int flow_loop_level_compute PARAMS ((struct loop *, int)); static int flow_loops_level_compute PARAMS ((struct loops *)); static void delete_dead_jumptables PARAMS ((void)); +static bool back_edge_of_syntactic_loop_p PARAMS ((basic_block, basic_block)); /* Find basic blocks of the current function. F is the first insn of the function and NREGS the number of register @@ -1968,6 +1969,30 @@ redirect_edge_and_branch_force (e, target) return new_bb; } +/* Helper function for split_edge. Return true in case edge BB2 to BB1 + is back edge of syntactic loop. */ +static bool +back_edge_of_syntactic_loop_p (bb1, bb2) + basic_block bb1, bb2; +{ + rtx insn; + int count; + if (bb1->index > bb2->index) + return false; + if (bb1->index == bb2->index) + return true; + for (insn = bb1->end; insn != bb2->head && count >= 0; + insn = NEXT_INSN (insn)) + if (GET_CODE (insn) == NOTE) + { + if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG) + count++; + if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END) + count--; + } + return count >= 0; +} + /* Split a (typically critical) edge. Return the new block. Abort on abnormal edges. @@ -2115,7 +2140,8 @@ split_edge (edge_in) 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) + && NOTE_LINE_NUMBER (PREV_INSN (old_succ->head)) == NOTE_INSN_LOOP_BEG + && !back_edge_of_syntactic_loop_p (old_succ, old_pred)) bb_note = emit_note_before (NOTE_INSN_BASIC_BLOCK, PREV_INSN (old_succ->head)); else if (old_succ != EXIT_BLOCK_PTR) |