Commit 5ea7a4ae by Jim Wilson

(scan_loop): New variable loop_depth.

(scan_loop): New variable loop_depth.	Increment and
decrement on LOOP_BEG and LOOP_END notes.  Only use LOOP_VTOP note
if loop_depth is zero.
(strength_reduce): Likewise.

From-SVN: r6811
parent 4c1b367c
...@@ -490,6 +490,8 @@ scan_loop (loop_start, end, nregs) ...@@ -490,6 +490,8 @@ scan_loop (loop_start, end, nregs)
if it was used exactly once; contains const0_rtx if it was used more if it was used exactly once; contains const0_rtx if it was used more
than once. */ than once. */
rtx *reg_single_usage = 0; rtx *reg_single_usage = 0;
/* Nonzero if we are scanning instructions in a sub-loop. */
int loop_depth = 0;
n_times_set = (short *) alloca (nregs * sizeof (short)); n_times_set = (short *) alloca (nregs * sizeof (short));
n_times_used = (short *) alloca (nregs * sizeof (short)); n_times_used = (short *) alloca (nregs * sizeof (short));
...@@ -921,12 +923,18 @@ scan_loop (loop_start, end, nregs) ...@@ -921,12 +923,18 @@ scan_loop (loop_start, end, nregs)
&& NEXT_INSN (NEXT_INSN (p)) == end && NEXT_INSN (NEXT_INSN (p)) == end
&& simplejump_p (p))) && simplejump_p (p)))
maybe_never = 1; maybe_never = 1;
/* At the virtual top of a converted loop, insns are again known to else if (GET_CODE (p) == NOTE)
be executed: logically, the loop begins here even though the exit {
code has been duplicated. */ /* At the virtual top of a converted loop, insns are again known to
else if (GET_CODE (p) == NOTE be executed: logically, the loop begins here even though the exit
&& NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_VTOP) code has been duplicated. */
maybe_never = call_passed = 0; if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_VTOP && loop_depth == 0)
maybe_never = call_passed = 0;
else if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_BEG)
loop_depth++;
else if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_END)
loop_depth--;
}
} }
/* If one movable subsumes another, ignore that other. */ /* If one movable subsumes another, ignore that other. */
...@@ -3157,6 +3165,7 @@ strength_reduce (scan_start, end, loop_top, insn_count, ...@@ -3157,6 +3165,7 @@ strength_reduce (scan_start, end, loop_top, insn_count,
int call_seen; int call_seen;
rtx test; rtx test;
rtx end_insert_before; rtx end_insert_before;
int loop_depth = 0;
reg_iv_type = (enum iv_mode *) alloca (max_reg_before_loop reg_iv_type = (enum iv_mode *) alloca (max_reg_before_loop
* sizeof (enum iv_mode *)); * sizeof (enum iv_mode *));
...@@ -3288,13 +3297,18 @@ strength_reduce (scan_start, end, loop_top, insn_count, ...@@ -3288,13 +3297,18 @@ strength_reduce (scan_start, end, loop_top, insn_count,
|| (NEXT_INSN (p) == loop_end && condjump_p (p))))) || (NEXT_INSN (p) == loop_end && condjump_p (p)))))
not_every_iteration = 1; not_every_iteration = 1;
/* At the virtual top of a converted loop, insns are again known to else if (GET_CODE (p) == NOTE)
be executed each iteration: logically, the loop begins here {
even though the exit code has been duplicated. */ /* At the virtual top of a converted loop, insns are again known to
be executed each iteration: logically, the loop begins here
else if (GET_CODE (p) == NOTE even though the exit code has been duplicated. */
&& NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_VTOP) if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_VTOP && loop_depth == 0)
not_every_iteration = 0; not_every_iteration = 0;
else if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_BEG)
loop_depth++;
else if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_END)
loop_depth--;
}
/* Unlike in the code motion pass where MAYBE_NEVER indicates that /* Unlike in the code motion pass where MAYBE_NEVER indicates that
an insn may never be executed, NOT_EVERY_ITERATION indicates whether an insn may never be executed, NOT_EVERY_ITERATION indicates whether
...@@ -3444,6 +3458,7 @@ strength_reduce (scan_start, end, loop_top, insn_count, ...@@ -3444,6 +3458,7 @@ strength_reduce (scan_start, end, loop_top, insn_count,
biv and a constant (or invariant), and it is not a biv. */ biv and a constant (or invariant), and it is not a biv. */
not_every_iteration = 0; not_every_iteration = 0;
loop_depth = 0;
p = scan_start; p = scan_start;
while (1) while (1)
{ {
...@@ -3560,13 +3575,18 @@ strength_reduce (scan_start, end, loop_top, insn_count, ...@@ -3560,13 +3575,18 @@ strength_reduce (scan_start, end, loop_top, insn_count,
|| (NEXT_INSN (p) == loop_end && condjump_p (p))))) || (NEXT_INSN (p) == loop_end && condjump_p (p)))))
not_every_iteration = 1; not_every_iteration = 1;
/* At the virtual top of a converted loop, insns are again known to else if (GET_CODE (p) == NOTE)
be executed each iteration: logically, the loop begins here {
even though the exit code has been duplicated. */ /* At the virtual top of a converted loop, insns are again known to
be executed each iteration: logically, the loop begins here
else if (GET_CODE (p) == NOTE even though the exit code has been duplicated. */
&& NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_VTOP) if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_VTOP && loop_depth == 0)
not_every_iteration = 0; not_every_iteration = 0;
else if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_BEG)
loop_depth++;
else if (NOTE_LINE_NUMBER (p) == NOTE_INSN_LOOP_END)
loop_depth--;
}
/* Unlike in the code motion pass where MAYBE_NEVER indicates that /* Unlike in the code motion pass where MAYBE_NEVER indicates that
an insn may never be executed, NOT_EVERY_ITERATION indicates whether an insn may never be executed, NOT_EVERY_ITERATION indicates whether
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment