From: Jose Renau Date: Thu, 26 Dec 2002 18:15:56 +0000 (+0000) Subject: ssa-dce.c (EXECUTE_IF_UNNECESSARY): Verify INSN is an INSN_P before checking to see... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ecd4a73b20577345fc2703e7e998b30b68bf75d6;p=gcc.git ssa-dce.c (EXECUTE_IF_UNNECESSARY): Verify INSN is an INSN_P before checking to see if it is dead. * 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. From-SVN: r60520 --- 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 + + * 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 * 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);