diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-12-26 18:15:56 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-12-26 18:15:56 +0000 |
commit | f358d8ebf53c62cf4d84d2d2e2c86f43396d18c6 (patch) | |
tree | 9a794edf33f5d0d6572f70b05a106554945370ab /gcc | |
parent | b74d9e84dde1652b34c7336928d2db89eca8d3a8 (diff) | |
download | gcc-f358d8ebf53c62cf4d84d2d2e2c86f43396d18c6.tar.gz |
* ssa-dce.c (EXECUTE_IF_UNNECESSARY): Verify INSN is an
INSN_P before checking to see if it is dead.
(mark_all_insn_unnecessary): Similarly.
(ssa_eliminate_dead_code): Similarly.
* rtl.h (struct rtx_def): Update comments for in_struct usage
in dead code elimination pass.
(INSN_DEAD_CODE_P): Allow JUMP_INSN and CALL_INSN as well.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@60520 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/rtl.h | 7 | ||||
-rw-r--r-- | gcc/ssa-dce.c | 24 |
3 files changed, 30 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cfbcf96e95b..b2601b768ca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2002-12-26 Jose Renau <renau@cs.uiuc.edu> + + * ssa-dce.c (EXECUTE_IF_UNNECESSARY): Verify INSN is an + INSN_P before checking to see if it is dead. + (mark_all_insn_unnecessary): Similarly. + (ssa_eliminate_dead_code): Similarly. + * rtl.h (struct rtx_def): Update comments for in_struct usage + in dead code elimination pass. + (INSN_DEAD_CODE_P): Allow JUMP_INSN and CALL_INSN as well. + 2002-12-26 Andreas Schwab <schwab@suse.de> * config.gcc (powerpc*-*-*, rs6000-*-*): Fix assignment syntax. diff --git a/gcc/rtl.h b/gcc/rtl.h index c873d9f6bd2..3cab166f527 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -174,8 +174,9 @@ struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"), 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and from the target of a branch. Valid from reorg until end of compilation; cleared before used. - 1 in an INSN or related rtx if this insn is dead code. Valid only during - dead-code elimination phase; cleared before use. */ + 1 in an INSN, JUMP_INSN or CALL_INSN or related rtx if this insn is + dead code. Valid only during dead-code elimination phase; cleared + before use. */ unsigned int in_struct : 1; /* At the end of RTL generation, 1 if this rtx is used. This is used for copying shared structure. See `unshare_all_rtl'. @@ -578,7 +579,7 @@ do { \ /* 1 if RTX is an insn that is dead code. Valid only for dead-code elimination phase. */ #define INSN_DEAD_CODE_P(RTX) \ - (RTL_FLAG_CHECK1("INSN_DEAD_CODE_P", (RTX), INSN)->in_struct) + (RTL_FLAG_CHECK3("INSN_DEAD_CODE_P", (RTX), INSN, CALL_INSN, JUMP_INSN)->in_struct) /* 1 if RTX is an insn in a delay slot and is from the target of the branch. If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be diff --git a/gcc/ssa-dce.c b/gcc/ssa-dce.c index 3584ca2ebc8..6ccc222cea6 100644 --- a/gcc/ssa-dce.c +++ b/gcc/ssa-dce.c @@ -135,10 +135,12 @@ static void mark_all_insn_unnecessary rtx INSN; \ \ for (INSN = get_insns (); INSN != NULL_RTX; INSN = NEXT_INSN (INSN)) \ - if (INSN_DEAD_CODE_P (INSN)) { \ - CODE; \ - } \ + if (INSN_P (insn) && INSN_DEAD_CODE_P (INSN)) \ + { \ + CODE; \ + } \ } + /* Find the label beginning block BB. */ static rtx find_block_label PARAMS ((basic_block bb)); @@ -448,8 +450,11 @@ static void mark_all_insn_unnecessary () { rtx insn; - for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn)) - KILL_INSN (insn); + for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn)) { + if (INSN_P (insn)) + KILL_INSN (insn); + } + } /* Find the label beginning block BB, adding one if necessary. */ @@ -522,7 +527,7 @@ ssa_eliminate_dead_code () /* Find inherently necessary instructions. */ for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn)) - if (find_inherently_necessary (insn)) + if (find_inherently_necessary (insn) && INSN_P (insn)) { RESURRECT_INSN (insn); VARRAY_PUSH_RTX (unprocessed_instructions, insn); @@ -725,8 +730,11 @@ ssa_eliminate_dead_code () } } /* Release allocated memory. */ - for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn)) - RESURRECT_INSN (insn); + for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn)) { + if (INSN_P (insn)) + RESURRECT_INSN (insn); + } + if (VARRAY_ACTIVE_SIZE (unprocessed_instructions) != 0) abort (); control_dependent_block_to_edge_map_free (cdbte); |