------- Comment #20 from zadeck at naturalbridge dot com 2007-06-27 14:39 ------- Subject: Re: [4.3 Regression] MIPS: FAIL in gcc.dg/cleanup-[8|9|10|11].c
richard at codesourcery dot com wrote: > ------- Comment #19 from richard at codesourcery dot com 2007-06-27 14:37 > ------- > Subject: Re: [4.3 Regression] MIPS: FAIL in gcc.dg/cleanup-[8|9|10|11].c > > Kenneth Zadeck <[EMAIL PROTECTED]> writes: > >> 2007-06-23 Kenneth Zadeck <[EMAIL PROTECTED]> >> >> PR middle-end/32437 >> *dce.c (deletable_insn_p): Add extra parameter and recurse if insn >> is a PARALLEL. >> (prescan_insns_for_dce): Add extra parameter. >> > > Kenny found that this patch introduced problems on x86 (I think it was) > because it applied the special handling for bare CLOBBERs to those > inside PARALLELs as well. We don't want that; bare USEs and CLOBBERs > are special DF markers, but USEs and CLOBBERs inside PARALLELs are parts > of asms or define_insns. > > Kenny pre-approved the patch below. Bootstrapped & regression-tested > on x86_64-linux-gnu. Applied to mainline. > > Richard > > > gcc/ > * dce.c (deletable_insn_p_1): New function, split out from... > (deletable_insn_p): ...here. Only treat bare USEs and CLOBBERs > specially, not those inside PARALLELs. Remove BODY argument > and adjust recursive call accordingly. > (prescan_insns_for_dce): Update call to delete_insn_p. > > Index: gcc/dce.c > =================================================================== > --- gcc/dce.c (revision 126053) > +++ gcc/dce.c (working copy) > @@ -58,16 +58,15 @@ static VEC(rtx,heap) *worklist; > > static sbitmap marked = NULL; > > -/* Return true if INSN with BODY is a normal instruction that can be > - deleted by the DCE pass. */ > +/* A subroutine for which BODY is part of the instruction being tested; > + either the top-level pattern, or an element of a PARALLEL. The > + instruction is known not to be a bare USE or CLOBBER. */ > > static bool > -deletable_insn_p (rtx insn, rtx body, bool fast) > +deletable_insn_p_1 (rtx body) > { > - rtx x; > switch (GET_CODE (body)) > { > - case USE: > case PREFETCH: > case TRAP_IF: > /* The UNSPEC case was added here because the ia-64 claims that > @@ -79,6 +78,35 @@ deletable_insn_p (rtx insn, rtx body, bo > case UNSPEC: > return false; > > + default: > + if (volatile_insn_p (body)) > + return false; > + > + if (flag_non_call_exceptions && may_trap_p (body)) > + return false; > + > + return true; > + } > +} > + > +/* Return true if INSN is a normal instruction that can be deleted by > + the DCE pass. */ > + > +static bool > +deletable_insn_p (rtx insn, bool fast) > +{ > + rtx body, x; > + int i; > + > + if (!NONJUMP_INSN_P (insn)) > + return false; > + > + body = PATTERN (insn); > + switch (GET_CODE (body)) > + { > + case USE: > + return false; > + > case CLOBBER: > if (fast) > { > @@ -88,32 +116,20 @@ deletable_insn_p (rtx insn, rtx body, bo > x = XEXP (body, 0); > return REG_P (x) && (!HARD_REGISTER_P (x) || reload_completed); > } > - else > + else > /* Because of the way that use-def chains are built, it is not > possible to tell if the clobber is dead because it can > never be the target of a use-def chain. */ > return false; > > case PARALLEL: > - { > - int i; > - for (i = XVECLEN (body, 0) - 1; i >= 0; i--) > - if (!deletable_insn_p (insn, XVECEXP (body, 0, i), fast)) > - return false; > - return true; > - } > + for (i = XVECLEN (body, 0) - 1; i >= 0; i--) > + if (!deletable_insn_p_1 (XVECEXP (body, 0, i))) > + return false; > + return true; > > default: > - if (!NONJUMP_INSN_P (insn)) > - return false; > - > - if (volatile_insn_p (body)) > - return false; > - > - if (flag_non_call_exceptions && may_trap_p (body)) > - return false; > - > - return true; > + return deletable_insn_p_1 (body); > } > } > > @@ -369,7 +385,7 @@ prescan_insns_for_dce (bool fast) > rtx note = find_reg_note (insn, REG_LIBCALL_ID, NULL_RTX); > if (note) > mark_libcall (insn, fast); > - else if (deletable_insn_p (insn, PATTERN (insn), fast)) > + else if (deletable_insn_p (insn, fast)) > mark_nonreg_stores (PATTERN (insn), insn, fast); > else > mark_insn (insn, fast); > > > thanks -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32437