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]

The recent regclass.c change


There was a patch to reg_scan_mark_refs recently that returns silently when
a NULL rtx is encountered.  A test case for this is 
linux-2.1.123/drivers/char/vt.c on i586-linux.  I believe the change is
incorrect (or at least the real problem is not fixed).
The function already distinguishes between two kinds of reg notes: those
which are EXPR_LIST (their contents are scanned) and those which are
INSN_LIST (their contents are insns, and they are not scanned).  So the
real problem is that we get a REG_WAS_0 note, which should be of the
INSN_LIST kind according to rtl.h, but which is in fact EXPR_LIST.
The problem is in duplicate_loop_exit_test, which handles the REG_WAS_0
note thrice wrong:
 - it always makes EXPR_LISTs
 - it copies the contents, instead of making a reference to the insn
 - the new note most likely contains the wrong insn, if the referenced
   insn is part of the duplicated loop exit test.

This patch undoes the regclass.c change and disables duplicate_loop_exit_test
if a REG_WAS_0 note is found.

Do we actually need REG_WAS_0 still?  As far as I can see it is used in
three machine descriptions to turn movl 0,reg to incl reg.  The same
transformation ought to be done by the new reload_move2add pass, oughtn't
it?

Bernd

	* jump.c (duplicate_loop_exit_test): Fail if we find a REG_WAS_0 note.
	* regclass.c (reg_scan_mark_refs): Undo Oct 2 change.

Index: jump.c
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/jump.c,v
retrieving revision 1.1.1.24
diff -u -r1.1.1.24 jump.c
--- jump.c	1998/09/07 20:54:31	1.1.1.24
+++ jump.c	1998/10/03 14:45:09
@@ -2431,7 +2431,7 @@
 
          is a CALL_INSN
 	 is a CODE_LABEL
-	 has a REG_RETVAL or REG_LIBCALL note (hard to adjust)
+	 has a REG_RETVAL, REG_LIBCALL, or REG_WAS_0 note (hard to adjust)
 	 is a NOTE_INSN_LOOP_BEG because this means we have a nested loop
 	 is a NOTE_INSN_BLOCK_{BEG,END} because duplicating these notes
 	      are not valid
@@ -2483,6 +2483,7 @@
 	  if (++num_insns > 20
 	      || find_reg_note (insn, REG_RETVAL, NULL_RTX)
 	      || find_reg_note (insn, REG_LIBCALL, NULL_RTX)
+	      || find_reg_note (insn, REG_WAS_0, NULL_RTX)
 	      || asm_noperands (PATTERN (insn)) > 0)
 	    return 0;
 	  break;
Index: regclass.c
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/regclass.c,v
retrieving revision 1.1.1.22
diff -u -r1.1.1.22 regclass.c
--- regclass.c	1998/10/02 16:41:26	1.1.1.22
+++ regclass.c	1998/10/03 14:24:35
@@ -1995,13 +1995,6 @@
   register rtx dest;
   register rtx note;
 
-  /* This can happen when scanning insns referenced by certain notes.
-
-     It is unclear if we should be scanning such insns; until someone can
-     say for sure this seems like the safest fix.  */
-  if (x == NULL_RTX)
-    return;
-
   code = GET_CODE (x);
   switch (code)
     {


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