try_split fix

Jan Hubicka jh@suse.cz
Fri Dec 15 06:21:00 GMT 2000


Hi
The instruction splitter may change destination of the insn (this happends for example
on the i386, where regsiters are promoted to larger mode).  In case only single
instruction is produced, the try_split reuse INSN from the original keeping
notes.  The REG_EQUIV/REG_EQUAL notes may be broken then.

The patch modifies try_split to remove the notes in the case insn has been turned
into non-single_set or changed destination.

Honza

Fri Dec 15 15:20:42 MET 2000  Jan Hubicka  <jh@suse.cz>
	* emit-rtl.c (try_split): Remove REG_EQUIV/REG_EQUAL notes in the case
	insn has changed destination or has been turned into non-single_set.

Index: egcs/gcc//emit-rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/emit-rtl.c,v
retrieving revision 1.157
diff -c -3 -p -r1.157 emit-rtl.c
*** emit-rtl.c	2000/11/30 06:31:17	1.157
--- emit-rtl.c	2000/12/15 14:13:10
*************** try_split (pat, trial, last)
*** 2461,2468 ****
--- 2468,2496 ----
  	return trial;
        else
  	{
+ 	  rtx new_dest, old_dest;
+ 	  old_dest = single_set (trial);
+ 	  if (old_dest)
+ 	    old_dest = SET_DEST (old_dest);
  	  PATTERN (trial) = seq;
  	  INSN_CODE (trial) = -1;
+ 	  new_dest = single_set (trial);
+ 	  if (new_dest)
+ 	    new_dest = SET_DEST (new_dest);
+ 	  /* In case we've turned single_set insn into PARALLEL, or changed
+ 	     the destination, we need to remove bogus REG_EQUAL/REG_EQUIV
+ 	     notes.  Changing of destination may happen for instance on i386,
+ 	     where splitters promote HImode arithmetics to the SImode.  */
+ 	  if (old_dest && (!new_dest || !rtx_equal_p (old_dest, new_dest)))
+ 	    {
+ 	      rtx note;
+ 	      note = find_reg_note (trial, REG_EQUAL, NULL_RTX);
+ 	      if (note)
+ 		remove_note (trial, note);
+ 	      note = find_reg_note (trial, REG_EQUIV, NULL_RTX);
+ 	      if (note)
+ 		remove_note (trial, note);
+ 	    }
  	  try_split (seq, trial, last);
  	}
  


More information about the Gcc-patches mailing list