Commit e48a7fbe by Jeffrey A Law Committed by Jeff Law

cse.c: Update comments.

        * cse.c: Update comments.
        (cse_insn): When converting a conditional/computed jump into
        an unconditional jump, always make sure a BARRIER immediately
        follows the converted jump.  Do not delete unreachable code.
        (cse_basic_block): Do not delete unreachable code.
        * toplev.c (rest_of_compilation): Move call to
        delete_trivially_dead_insns after the conditional call to
        jump_optimize.

From-SVN: r29665
parent 57151693
Sat Sep 25 13:11:07 1999 Jeffrey A Law (law@cygnus.com)
* cse.c: Update comments.
(cse_insn): When converting a conditional/computed jump into
an unconditional jump, always make sure a BARRIER immediately
follows the converted jump. Do not delete unreachable code.
(cse_basic_block): Do not delete unreachable code.
* toplev.c (rest_of_compilation): Move call to
delete_trivially_dead_insns after the conditional call to
jump_optimize.
Sat Sep 25 09:03:17 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> Sat Sep 25 09:03:17 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* collect2.c (make_temp_file): Don't prototype. * collect2.c (make_temp_file): Don't prototype.
......
...@@ -45,12 +45,14 @@ Boston, MA 02111-1307, USA. */ ...@@ -45,12 +45,14 @@ Boston, MA 02111-1307, USA. */
expressions encountered with the cheapest equivalent expression. expressions encountered with the cheapest equivalent expression.
It is too complicated to keep track of the different possibilities It is too complicated to keep track of the different possibilities
when control paths merge; so, at each label, we forget all that is when control paths merge in this code; so, at each label, we forget all
known and start fresh. This can be described as processing each that is known and start fresh. This can be described as processing each
basic block separately. Note, however, that these are not quite extended basic block separately. We have a separate pass to perform
the same as the basic blocks found by a later pass and used for global CSE.
data flow analysis and register packing. We do not need to start fresh
after a conditional jump instruction if there is no label there. Note CSE can turn a conditional or computed jump into a nop or
an unconditional jump. When this occurs we arrange to run the jump
optimizer after CSE to delete the unreachable code.
We use two data structures to record the equivalent expressions: We use two data structures to record the equivalent expressions:
a hash table for most expressions, and several vectors together a hash table for most expressions, and several vectors together
...@@ -7417,7 +7419,6 @@ cse_insn (insn, libcall_insn) ...@@ -7417,7 +7419,6 @@ cse_insn (insn, libcall_insn)
rtx new = emit_jump_insn_before (gen_jump (XEXP (src, 0)), insn); rtx new = emit_jump_insn_before (gen_jump (XEXP (src, 0)), insn);
JUMP_LABEL (new) = XEXP (src, 0); JUMP_LABEL (new) = XEXP (src, 0);
LABEL_NUSES (XEXP (src, 0))++; LABEL_NUSES (XEXP (src, 0))++;
delete_insn (insn);
insn = new; insn = new;
} }
else else
...@@ -7428,44 +7429,13 @@ cse_insn (insn, libcall_insn) ...@@ -7428,44 +7429,13 @@ cse_insn (insn, libcall_insn)
Until the right place is found, might as well do this here. */ Until the right place is found, might as well do this here. */
INSN_CODE (insn) = -1; INSN_CODE (insn) = -1;
/* Now that we've converted this jump to an unconditional jump,
there is dead code after it. Delete the dead code until we
reach a BARRIER, the end of the function, or a label. Do
not delete NOTEs except for NOTE_INSN_DELETED since later
phases assume these notes are retained. */
never_reached_warning (insn); never_reached_warning (insn);
p = insn; /* Now emit a BARRIER after the unconditional jump. Do not bother
deleting any unreachable code, let jump/flow do that. */
while (NEXT_INSN (p) != 0 if (NEXT_INSN (insn) != 0
&& GET_CODE (NEXT_INSN (p)) != BARRIER && GET_CODE (NEXT_INSN (insn)) != BARRIER)
&& GET_CODE (NEXT_INSN (p)) != CODE_LABEL) emit_barrier_after (insn);
{
/* Note, we must update P with the return value from
delete_insn, otherwise we could get an infinite loop
if NEXT_INSN (p) had INSN_DELETED_P set. */
if (GET_CODE (NEXT_INSN (p)) != NOTE
|| NOTE_LINE_NUMBER (NEXT_INSN (p)) == NOTE_INSN_DELETED)
p = PREV_INSN (delete_insn (NEXT_INSN (p)));
else
p = NEXT_INSN (p);
}
/* If we don't have a BARRIER immediately after INSN, put one there.
Much code assumes that there are no NOTEs between a JUMP_INSN and
BARRIER. */
if (NEXT_INSN (insn) == 0
|| GET_CODE (NEXT_INSN (insn)) != BARRIER)
emit_barrier_before (NEXT_INSN (insn));
/* We might have two BARRIERs separated by notes. Delete the second
one if so. */
if (p != insn && NEXT_INSN (p) != 0
&& GET_CODE (NEXT_INSN (p)) == BARRIER)
delete_insn (NEXT_INSN (p));
cse_jumps_altered = 1; cse_jumps_altered = 1;
sets[i].rtl = 0; sets[i].rtl = 0;
...@@ -8968,9 +8938,6 @@ cse_basic_block (from, to, next_branch, around_loop) ...@@ -8968,9 +8938,6 @@ cse_basic_block (from, to, next_branch, around_loop)
insn = NEXT_INSN (to); insn = NEXT_INSN (to);
if (LABEL_NUSES (to) == 0)
insn = delete_insn (to);
/* If TO was the last insn in the function, we are done. */ /* If TO was the last insn in the function, we are done. */
if (insn == 0) if (insn == 0)
return 0; return 0;
......
...@@ -3745,8 +3745,6 @@ rest_of_compilation (decl) ...@@ -3745,8 +3745,6 @@ rest_of_compilation (decl)
TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (), TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
0, rtl_dump_file)); 0, rtl_dump_file));
TIMEVAR (cse_time, delete_trivially_dead_insns (insns, max_reg_num ()));
/* If we are not running the second CSE pass, then we are no longer /* If we are not running the second CSE pass, then we are no longer
expecting CSE to be run. */ expecting CSE to be run. */
cse_not_expected = !flag_rerun_cse_after_loop; cse_not_expected = !flag_rerun_cse_after_loop;
...@@ -3756,6 +3754,10 @@ rest_of_compilation (decl) ...@@ -3756,6 +3754,10 @@ rest_of_compilation (decl)
!JUMP_NOOP_MOVES, !JUMP_NOOP_MOVES,
!JUMP_AFTER_REGSCAN)); !JUMP_AFTER_REGSCAN));
/* Run this after jump optmizations remove all the unreachable code
so that unreachable code will not keep values live. */
TIMEVAR (cse_time, delete_trivially_dead_insns (insns, max_reg_num ()));
/* Try to identify useless null pointer tests and delete them. */ /* Try to identify useless null pointer tests and delete them. */
if (flag_delete_null_pointer_checks) if (flag_delete_null_pointer_checks)
TIMEVAR (jump_time, delete_null_pointer_checks (get_insns ())); TIMEVAR (jump_time, delete_null_pointer_checks (get_insns ()));
......
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