This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/32437] [4.3 Regression] MIPS: FAIL in gcc.dg/cleanup-[8|9|10|11].c
- From: "zadeck at naturalbridge dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jun 2007 16:23:04 -0000
- Subject: [Bug target/32437] [4.3 Regression] MIPS: FAIL in gcc.dg/cleanup-[8|9|10|11].c
- References: <bug-32437-7151@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #12 from zadeck at naturalbridge dot com 2007-06-23 16:23 -------
Subject: Re: [4.3 Regression] MIPS: FAIL in gcc.dg/cleanup-[8|9|10|11].c
Richard Guenther wrote:
> On 6/23/07, Kenneth Zadeck <zadeck@naturalbridge.com> wrote:
>> This patch changes dce:deletable_insn_p so that it looks at all of the
>> top level
>> clauses in a parallel to make it's decision. It was not keeping insns
>> that had a top level USE or UNSPEC if they were inside of parallels.
>>
>> This should fix pr32437 and perhaps other things.
>>
>> The patch has only been tested on ppc and x86-64. It is harmless on
>> those platforms.
>> It is likely to make a difference on pa-risc and mips where there are
>> parallels that contain top level unspecs.
>>
>> Ok to commit?
>
> This is ok for mainline.
>
> Thanks,
> Richard.
>
>>
>> 2007-06-23 Kenneth Zadeck <zadeck@naturalbridge.com>
>>
>> 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.
>>
>>
>>
>>
committed as revision 125972.
2007-06-23 Kenneth Zadeck <zadeck@naturalbridge.com>
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.
Index: dce.c
===================================================================
--- dce.c (revision 125971)
+++ dce.c (working copy)
@@ -58,15 +58,14 @@ static bitmap_obstack dce_tmp_bitmap_obs
static sbitmap marked = NULL;
-/* Return true if INSN a normal instruction that can be deleted by the
- DCE pass. */
+/* Return true if INSN with BODY is a normal instruction that can be
+ deleted by the DCE pass. */
static bool
-deletable_insn_p (rtx insn, bool fast)
+deletable_insn_p (rtx insn, rtx body, bool fast)
{
rtx x;
-
- switch (GET_CODE (PATTERN (insn)))
+ switch (GET_CODE (body))
{
case USE:
case PREFETCH:
@@ -86,7 +85,7 @@ deletable_insn_p (rtx insn, bool fast)
/* A CLOBBER of a dead pseudo register serves no purpose.
That is not necessarily true for hard registers until
after reload. */
- x = XEXP (PATTERN (insn), 0);
+ x = XEXP (body, 0);
return REG_P (x) && (!HARD_REGISTER_P (x) || reload_completed);
}
else
@@ -95,14 +94,23 @@ deletable_insn_p (rtx insn, bool fast)
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;
+ }
+
default:
if (!NONJUMP_INSN_P (insn))
return false;
- if (volatile_insn_p (PATTERN (insn)))
+ if (volatile_insn_p (body))
return false;
- if (flag_non_call_exceptions && may_trap_p (PATTERN (insn)))
+ if (flag_non_call_exceptions && may_trap_p (body))
return false;
return true;
@@ -361,7 +369,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, fast))
+ else if (deletable_insn_p (insn, PATTERN (insn), fast))
mark_nonreg_stores (PATTERN (insn), insn, fast);
else
mark_insn (insn, fast);
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32437