Patchwork allocate combine.c:LOG_LINKS in an obstack

login
register
mail settings
Submitter Nathan Froyd
Date April 5, 2011, 6:28 p.m.
Message ID <20110405182820.GC27880@nightcrawler>
Download mbox | patch
Permalink /patch/89917/
State New
Headers show

Comments

Nathan Froyd - April 5, 2011, 6:28 p.m.
On Tue, Apr 05, 2011 at 11:22:56AM -0700, Nathan Froyd wrote:
> On Tue, Apr 05, 2011 at 09:59:43AM -0400, Nathan Froyd wrote:
> > On Mon, Apr 04, 2011 at 02:49:54PM -0400, Nathan Froyd wrote:
> > > This patch does just what $SUBJECT suggests.
> > 
> > v2, now with obstacks!
> 
> This broke compilation on AUTO_INC_DEC targets.  Currently putting
> together a fix and testing via cross to powerpc-eabispe.

...and here's the patch I'm going to install.

-Nathan

	* combine.c (combine_instructions) [AUTO_INC_DEC]: Declare links
	as an rtx.
	(try_combine) [AUTO_INC_DEC]: Declare a local link rtx.
H.J. Lu - April 5, 2011, 7:29 p.m.
On Tue, Apr 5, 2011 at 11:28 AM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> On Tue, Apr 05, 2011 at 11:22:56AM -0700, Nathan Froyd wrote:
>> On Tue, Apr 05, 2011 at 09:59:43AM -0400, Nathan Froyd wrote:
>> > On Mon, Apr 04, 2011 at 02:49:54PM -0400, Nathan Froyd wrote:
>> > > This patch does just what $SUBJECT suggests.
>> >
>> > v2, now with obstacks!
>>
>> This broke compilation on AUTO_INC_DEC targets.  Currently putting
>> together a fix and testing via cross to powerpc-eabispe.
>
> ...and here's the patch I'm going to install.
>
> -Nathan
>
>        * combine.c (combine_instructions) [AUTO_INC_DEC]: Declare links
>        as an rtx.
>        (try_combine) [AUTO_INC_DEC]: Declare a local link rtx.
>

I think it caused:

http://gcc.gnu.org/ml/gcc-cvs/2011-04/msg00188.html
H.J. Lu - April 5, 2011, 7:32 p.m.
On Tue, Apr 5, 2011 at 11:28 AM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> On Tue, Apr 05, 2011 at 11:22:56AM -0700, Nathan Froyd wrote:
>> On Tue, Apr 05, 2011 at 09:59:43AM -0400, Nathan Froyd wrote:
>> > On Mon, Apr 04, 2011 at 02:49:54PM -0400, Nathan Froyd wrote:
>> > > This patch does just what $SUBJECT suggests.
>> >
>> > v2, now with obstacks!
>>
>> This broke compilation on AUTO_INC_DEC targets.  Currently putting
>> together a fix and testing via cross to powerpc-eabispe.
>
> ...and here's the patch I'm going to install.
>
> -Nathan
>
>        * combine.c (combine_instructions) [AUTO_INC_DEC]: Declare links
>        as an rtx.
>        (try_combine) [AUTO_INC_DEC]: Declare a local link rtx.
>
> diff --git a/gcc/combine.c b/gcc/combine.c
> index 30b7fdd..3e4a38c 100644
> --- a/gcc/combine.c
> +++ b/gcc/combine.c
> @@ -1139,6 +1139,8 @@ combine_instructions (rtx f, unsigned int nregs)
>       FOR_BB_INSNS (this_basic_block, insn)
>         if (INSN_P (insn) && BLOCK_FOR_INSN (insn))
>          {
> +            rtx links;
^^^^^^^^^^^^^^^^^^^^^^

links may be unused if  AUTO_INC_DEC is not defined.


> +
>             subst_low_luid = DF_INSN_LUID (insn);
>             subst_insn = insn;
>
> @@ -2911,15 +2913,18 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p)
>     /* It's not the exception.  */
>  #endif
>  #ifdef AUTO_INC_DEC
> -    for (link = REG_NOTES (i3); link; link = XEXP (link, 1))
> -      if (REG_NOTE_KIND (link) == REG_INC
> -         && (reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i2))
> -             || (i1 != 0
> -                 && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i1)))))
> -       {
> -         undo_all ();
> -         return 0;
> -       }
> +    {
> +      rtx link;
> +      for (link = REG_NOTES (i3); link; link = XEXP (link, 1))
> +       if (REG_NOTE_KIND (link) == REG_INC
> +           && (reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i2))
> +               || (i1 != 0
> +                   && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i1)))))
> +         {
> +           undo_all ();
> +           return 0;
> +         }
> +    }
>  #endif
>
>   /* See if the SETs in I1 or I2 need to be kept around in the merged
>
Nathan Froyd - April 5, 2011, 7:33 p.m.
On Tue, Apr 05, 2011 at 12:29:45PM -0700, H.J. Lu wrote:
> On Tue, Apr 5, 2011 at 11:28 AM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> >> This broke compilation on AUTO_INC_DEC targets.  Currently putting
> >> together a fix and testing via cross to powerpc-eabispe.
> >
> > ...and here's the patch I'm going to install.
> >
> >        * combine.c (combine_instructions) [AUTO_INC_DEC]: Declare links
> >        as an rtx.
> >        (try_combine) [AUTO_INC_DEC]: Declare a local link rtx.
> >
> 
> I think it caused:
> 
> http://gcc.gnu.org/ml/gcc-cvs/2011-04/msg00188.html

Why yes, I believe my patch did cause that message to be sent to
gcc-cvs. :)

Anyway, I have checked in the obvious fix for PR bootstrap/48469.

-Nathan

Patch

diff --git a/gcc/combine.c b/gcc/combine.c
index 30b7fdd..3e4a38c 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1139,6 +1139,8 @@  combine_instructions (rtx f, unsigned int nregs)
       FOR_BB_INSNS (this_basic_block, insn)
         if (INSN_P (insn) && BLOCK_FOR_INSN (insn))
 	  {
+            rtx links;
+
             subst_low_luid = DF_INSN_LUID (insn);
             subst_insn = insn;
 
@@ -2911,15 +2913,18 @@  try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p)
     /* It's not the exception.  */
 #endif
 #ifdef AUTO_INC_DEC
-    for (link = REG_NOTES (i3); link; link = XEXP (link, 1))
-      if (REG_NOTE_KIND (link) == REG_INC
-	  && (reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i2))
-	      || (i1 != 0
-		  && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i1)))))
-	{
-	  undo_all ();
-	  return 0;
-	}
+    {
+      rtx link;
+      for (link = REG_NOTES (i3); link; link = XEXP (link, 1))
+	if (REG_NOTE_KIND (link) == REG_INC
+	    && (reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i2))
+		|| (i1 != 0
+		    && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (i1)))))
+	  {
+	    undo_all ();
+	    return 0;
+	  }
+    }
 #endif
 
   /* See if the SETs in I1 or I2 need to be kept around in the merged