This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix for PR 14838


> The enclosed change fixes PR 14838.  It makes get_first_nonnote_insn
> and get_last_nonnote_insn more conservative in that they no longer
> assume that the first/last insn is always a note insn.
> 
> The only users of these two functions are pa.c and avr.c.

I'm afraid the fix for PR 14838 fixed one problem and introduced another
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18730>.  I failed to consider
the case where the first/last insn is a sequence.

This change fixes the bootstrap failure of the hppa1.1-hp-hpux10.20.
Tested on hppa1.1-hp-hpux10.20, hppa2.0w-hp-hpux11.11 and
hppa64-hp-hpux11.11 for the last week with no regressions.

Ok for 3.3, 3.4 and main?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2004-12-04  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	PR middle-end/18730
	* emit-rtl.c (get_first_nonnote_insn, get_last_nonnote_insn): When
	the first/last insn is a sequence, return the first/last insn of the
	sequence.

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.365.4.6
diff -u -3 -p -r1.365.4.6 emit-rtl.c
--- emit-rtl.c	23 Nov 2004 03:01:10 -0000	1.365.4.6
+++ emit-rtl.c	30 Nov 2004 03:43:47 -0000
@@ -2908,9 +2908,22 @@ get_last_insn_anywhere (void)
 rtx
 get_first_nonnote_insn (void)
 {
-  rtx insn;
+  rtx insn = first_insn;
+
+  if (insn)
+    {
+      if (NOTE_P (insn))
+	for (insn = next_insn (insn);
+	     insn && NOTE_P (insn);
+	     insn = next_insn (insn));
+      else
+	{
+	  if (GET_CODE (insn) == INSN
+	      && GET_CODE (PATTERN (insn)) == SEQUENCE)
+	    insn = XVECEXP (PATTERN (insn), 0, 0);
+	}
+    }
 
-  for (insn = first_insn; insn && NOTE_P (insn); insn = next_insn (insn));
   return insn;
 }
 
@@ -2920,9 +2933,23 @@ get_first_nonnote_insn (void)
 rtx
 get_last_nonnote_insn (void)
 {
-  rtx insn;
+  rtx insn = last_insn;
+
+  if (insn)
+    {
+      if (NOTE_P (insn))
+	for (insn = previous_insn (insn);
+	     insn && NOTE_P (insn);
+	     insn = previous_insn (insn));
+      else
+	{
+	  if (GET_CODE (insn) == INSN
+	      && GET_CODE (PATTERN (insn)) == SEQUENCE)
+	    insn = XVECEXP (PATTERN (insn), 0,
+			    XVECLEN (PATTERN (insn), 0) - 1);
+	}
+    }
 
-  for (insn = last_insn; insn && NOTE_P (insn); insn = previous_insn (insn));
   return insn;
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]