[multiple changes]
2007-07-01 Richard Sandiford <richard@codesourcery.com> Unreverting Richard's Revert of: 2007-06-27 Richard Sandiford <richard@codesourcery.com> * 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. From-SVN: r126168
This commit is contained in:
parent
7ee1ad8483
commit
d4d7f1d1bb
|
@ -1,3 +1,15 @@
|
||||||
|
2007-07-01 Richard Sandiford <richard@codesourcery.com>
|
||||||
|
|
||||||
|
Unreverting Richard's Revert of:
|
||||||
|
|
||||||
|
2007-06-27 Richard Sandiford <richard@codesourcery.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2007-07-01 Vladimir Yanovsky <yanov@il.ibm.com>
|
2007-07-01 Vladimir Yanovsky <yanov@il.ibm.com>
|
||||||
Revital Eres <eres@il.ibm.com>
|
Revital Eres <eres@il.ibm.com>
|
||||||
|
|
||||||
|
|
64
gcc/dce.c
64
gcc/dce.c
|
@ -58,16 +58,15 @@ static bitmap_obstack dce_tmp_bitmap_obstack;
|
||||||
|
|
||||||
static sbitmap marked = NULL;
|
static sbitmap marked = NULL;
|
||||||
|
|
||||||
/* Return true if INSN with BODY is a normal instruction that can be
|
/* A subroutine for which BODY is part of the instruction being tested;
|
||||||
deleted by the DCE pass. */
|
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
|
static bool
|
||||||
deletable_insn_p (rtx insn, rtx body, bool fast)
|
deletable_insn_p_1 (rtx body)
|
||||||
{
|
{
|
||||||
rtx x;
|
|
||||||
switch (GET_CODE (body))
|
switch (GET_CODE (body))
|
||||||
{
|
{
|
||||||
case USE:
|
|
||||||
case PREFETCH:
|
case PREFETCH:
|
||||||
case TRAP_IF:
|
case TRAP_IF:
|
||||||
/* The UNSPEC case was added here because the ia-64 claims that
|
/* The UNSPEC case was added here because the ia-64 claims that
|
||||||
|
@ -79,6 +78,35 @@ deletable_insn_p (rtx insn, rtx body, bool fast)
|
||||||
case UNSPEC:
|
case UNSPEC:
|
||||||
return false;
|
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:
|
case CLOBBER:
|
||||||
if (fast)
|
if (fast)
|
||||||
{
|
{
|
||||||
|
@ -88,32 +116,20 @@ deletable_insn_p (rtx insn, rtx body, bool fast)
|
||||||
x = XEXP (body, 0);
|
x = XEXP (body, 0);
|
||||||
return REG_P (x) && (!HARD_REGISTER_P (x) || reload_completed);
|
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
|
/* Because of the way that use-def chains are built, it is not
|
||||||
possible to tell if the clobber is dead because it can
|
possible to tell if the clobber is dead because it can
|
||||||
never be the target of a use-def chain. */
|
never be the target of a use-def chain. */
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case PARALLEL:
|
case PARALLEL:
|
||||||
{
|
for (i = XVECLEN (body, 0) - 1; i >= 0; i--)
|
||||||
int i;
|
if (!deletable_insn_p_1 (XVECEXP (body, 0, i)))
|
||||||
for (i = XVECLEN (body, 0) - 1; i >= 0; i--)
|
return false;
|
||||||
if (!deletable_insn_p (insn, XVECEXP (body, 0, i), fast))
|
return true;
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (!NONJUMP_INSN_P (insn))
|
return deletable_insn_p_1 (body);
|
||||||
return false;
|
|
||||||
|
|
||||||
if (volatile_insn_p (body))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (flag_non_call_exceptions && may_trap_p (body))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +385,7 @@ prescan_insns_for_dce (bool fast)
|
||||||
rtx note = find_reg_note (insn, REG_LIBCALL_ID, NULL_RTX);
|
rtx note = find_reg_note (insn, REG_LIBCALL_ID, NULL_RTX);
|
||||||
if (note)
|
if (note)
|
||||||
mark_libcall (insn, fast);
|
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);
|
mark_nonreg_stores (PATTERN (insn), insn, fast);
|
||||||
else
|
else
|
||||||
mark_insn (insn, fast);
|
mark_insn (insn, fast);
|
||||||
|
|
Loading…
Reference in New Issue