Patchwork Fix pr57637

login
register
mail settings
Submitter Zhenqiang Chen
Date July 5, 2013, 9:37 a.m.
Message ID <CACgzC7BDApKBCn641xkMtFSSNVTMYioQDLUe3urL=x+RTjJZwg@mail.gmail.com>
Download mbox | patch
Permalink /patch/257067/
State New
Headers show

Comments

Zhenqiang Chen - July 5, 2013, 9:37 a.m.
On 5 July 2013 16:18, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Jul 05, 2013 at 04:11:00PM +0800, Zhenqiang Chen wrote:
>> +       FOR_BB_INSNS(bb, x)
>
> Just style nits:
> Missing space between (.  Also, please don't use uppercase names
> for labels.
>
>         Jakub

Thanks for the comments. Update it as:
Zhenqiang Chen - July 10, 2013, 3:42 p.m.
Ping?

Thanks!
-Zhenqiang

On 5 July 2013 17:37, Zhenqiang Chen <zhenqiang.chen@linaro.org> wrote:
> On 5 July 2013 16:18, Jakub Jelinek <jakub@redhat.com> wrote:
>> On Fri, Jul 05, 2013 at 04:11:00PM +0800, Zhenqiang Chen wrote:
>>> +       FOR_BB_INSNS(bb, x)
>>
>> Just style nits:
>> Missing space between (.  Also, please don't use uppercase names
>> for labels.
>>
>>         Jakub
>
> Thanks for the comments. Update it as:
>
> diff --git a/gcc/function.c b/gcc/function.c
> index 3e33fc7..0d15db4 100644
> --- a/gcc/function.c
> +++ b/gcc/function.c
> @@ -5524,12 +5524,40 @@ move_insn_for_shrink_wrap (basic_block bb, rtx insn,
>           SET_REGNO_REG_SET (live_in, i);
>         }
>
> +      /* DF_LR_BB_INFO (bb)->def does not cover the DF_REF_PARTIAL and
> +        DF_REF_CONDITIONAL def.  So recheck the DF_INSN_DEFS.  */
> +      if (next_block)
> +       {
> +         rtx x;
> +         df_ref *def_rec;
> +
> +         FOR_BB_INSNS (bb, x)
> +           {
> +             if (!NONDEBUG_INSN_P (x))
> +               continue;
> +
> +             for (def_rec = DF_INSN_DEFS (x); *def_rec; def_rec++)
> +               {
> +                 df_ref def = *def_rec;
> +                 unsigned int regno = DF_REF_REGNO (def);
> +
> +                 for (i = dregno; i < end_dregno; i++)
> +                   if (i == regno)
> +                     goto move_insn_done;
> +                 for (i = sregno; i < end_sregno; i++)
> +                   if (i == regno)
> +                     goto move_insn_done;
> +               }
> +           }
> +       }
> +
>        /* If we don't need to add the move to BB, look for a single
>          successor block.  */
>        if (next_block)
>         next_block = next_block_for_reg (next_block, dregno, end_dregno);
>      }
>    while (next_block);
> +move_insn_done:
>
>    /* BB now defines DEST.  It only uses the parts of DEST that overlap SRC
>       (next loop).  */

Patch

diff --git a/gcc/function.c b/gcc/function.c
index 3e33fc7..0d15db4 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5524,12 +5524,40 @@  move_insn_for_shrink_wrap (basic_block bb, rtx insn,
 	  SET_REGNO_REG_SET (live_in, i);
 	}

+      /* DF_LR_BB_INFO (bb)->def does not cover the DF_REF_PARTIAL and
+	 DF_REF_CONDITIONAL def.  So recheck the DF_INSN_DEFS.  */
+      if (next_block)
+	{
+	  rtx x;
+	  df_ref *def_rec;
+
+	  FOR_BB_INSNS (bb, x)
+	    {
+	      if (!NONDEBUG_INSN_P (x))
+		continue;
+
+	      for (def_rec = DF_INSN_DEFS (x); *def_rec; def_rec++)
+		{
+		  df_ref def = *def_rec;
+		  unsigned int regno = DF_REF_REGNO (def);
+
+		  for (i = dregno; i < end_dregno; i++)
+		    if (i == regno)
+		      goto move_insn_done;
+		  for (i = sregno; i < end_sregno; i++)
+		    if (i == regno)
+		      goto move_insn_done;
+		}
+	    }
+	}
+
       /* If we don't need to add the move to BB, look for a single
 	 successor block.  */
       if (next_block)
 	next_block = next_block_for_reg (next_block, dregno, end_dregno);
     }
   while (next_block);
+move_insn_done:

   /* BB now defines DEST.  It only uses the parts of DEST that overlap SRC
      (next loop).  */