aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/cse.c12
-rw-r--r--gcc/rtl.h2
-rw-r--r--gcc/toplev.c13
4 files changed, 25 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1c15d1d..b002afa 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+Sat Apr 11 01:24:28 1998 Jeffrey A Law (law@cygnus.com)
+
+ * cse.c (count_reg_usage): Correctly handle REG_NONNEG notes.
+ (delete_trivially_dead_insns): Renamed from delete_dead_from_cse.
+ * toplev.c (rest_of_compilation): Call delete_trivially_dead_insns instead of delete_dead_from_cse. Also call delete_trivially_dead_insns
+ between loop optimization passes.
+ * rtl.h: Updated appropriately.
+
Fri Apr 10 22:28:32 1998 Jeffrey A Law (law@cygnus.com)
Reinstall this patch from Jason.
diff --git a/gcc/cse.c b/gcc/cse.c
index 990ef5f..19a02ef 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -8731,7 +8731,7 @@ count_reg_usage (x, counts, dest, incr)
case EXPR_LIST:
case INSN_LIST:
if (REG_NOTE_KIND (x) == REG_EQUAL
- || GET_CODE (XEXP (x,0)) == USE)
+ || (REG_NOTE_KIND (x) != REG_NONNEG && GET_CODE (XEXP (x,0)) == USE))
count_reg_usage (XEXP (x, 0), counts, NULL_RTX, incr);
count_reg_usage (XEXP (x, 1), counts, NULL_RTX, incr);
return;
@@ -8754,13 +8754,13 @@ count_reg_usage (x, counts, dest, incr)
/* Scan all the insns and delete any that are dead; i.e., they store a register
that is never used or they copy a register to itself.
- This is used to remove insns made obviously dead by cse. It improves the
- heuristics in loop since it won't try to move dead invariants out of loops
- or make givs for dead quantities. The remaining passes of the compilation
- are also sped up. */
+ This is used to remove insns made obviously dead by cse, loop or other
+ optimizations. It improves the heuristics in loop since it won't try to
+ move dead invariants out of loops or make givs for dead quantities. The
+ remaining passes of the compilation are also sped up. */
void
-delete_dead_from_cse (insns, nreg)
+delete_trivially_dead_insns (insns, nreg)
rtx insns;
int nreg;
{
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 0d3d5b7..c01770a 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1115,7 +1115,7 @@ extern int read_skip_spaces PROTO ((FILE *));
/* In cse.c */
struct cse_basic_block_data;
extern int rtx_cost PROTO ((rtx, enum rtx_code));
-extern void delete_dead_from_cse PROTO ((rtx, int));
+extern void delete_trivially_dead_insns PROTO ((rtx, int));
#ifdef BUFSIZ
extern int cse_main PROTO ((rtx, int, int, FILE *));
#endif
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 90cc6f4..b841b2c 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -3211,7 +3211,7 @@ rest_of_compilation (decl)
TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
0, rtl_dump_file));
- TIMEVAR (cse_time, delete_dead_from_cse (insns, max_reg_num ()));
+ TIMEVAR (cse_time, delete_trivially_dead_insns (insns, max_reg_num ()));
if (tem || optimize > 1)
TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
@@ -3244,8 +3244,15 @@ rest_of_compilation (decl)
loop_optimize (insns, rtl_dump_file, 0);
- /* The regscan pass may not be necessary, but let's
- be safe until we can prove otherwise. */
+
+ /* The first call to loop_optimize makes some instructions
+ trivially dead. We delete those instructions now in the
+ hope that doing so will make the heuristics in loop work
+ better and possibly speed up compilation. */
+ delete_trivially_dead_insns (insns, max_reg_num ());
+
+ /* The regscan pass is currently necessary as the alias
+ analysis code depends on this information. */
reg_scan (insns, max_reg_num (), 1);
}
loop_optimize (insns, rtl_dump_file, flag_unroll_loops);