simplify_replace_rtx fix

Jan Hubicka jh@suse.cz
Fri Apr 27 04:32:00 GMT 2001


Hi
simplify_replace_fix just bails out on comparisons and mems forgetting update
the internals.
It does the same for some subregs, but fix is not so easy, so I will send it
separately.

This improves the gcse cprop pass marcantly and almost eliminates the slowdown
caused on specs by Kenner's patches in mid of last month.

Fri Apr 27 13:31:30 CEST 2001  Jan Hubicka  <jh@suse.cz>
	* simplify-rtx.c (simplify_replace_rtx): Handle relationals and MEMs.
Index: gcc/simplify-rtx.c
===================================================================
RCS file: /home/cvs/Repository/gcc/gcc/simplify-rtx.c,v
retrieving revision 1.10
diff -c -3 -p -r1.10 simplify-rtx.c
*** gcc/simplify-rtx.c	2001/03/26 15:37:29	1.10
--- gcc/simplify-rtx.c	2001/04/27 10:21:26
*************** simplify_replace_rtx (x, old, new)
*** 238,243 ****
--- 241,254 ----
  	simplify_gen_binary (code, mode,
  			     simplify_replace_rtx (XEXP (x, 0), old, new),
  			     simplify_replace_rtx (XEXP (x, 1), old, new));
+     case '<':
+       return
+ 	simplify_gen_relational (code, mode,
+ 				 (GET_MODE (XEXP (x, 0)) != VOIDmode
+ 				  ? GET_MODE (XEXP (x, 0))
+ 				  : GET_MODE (XEXP (x, 1))),
+ 				 simplify_replace_rtx (XEXP (x, 0), old, new),
+ 				 simplify_replace_rtx (XEXP (x, 1), old, new));
  
      case '3':
      case 'b':
*************** simplify_replace_rtx (x, old, new)
*** 258,265 ****
--- 269,294 ----
        return x;
  
      default:
+       if (GET_CODE (x) == MEM)
+ 	{
+ 	  /* We can't use change_address here, since it verifies memory address
+ 	     for corectness.  We don't want such check, since we may handle
+ 	     addresses previously incorect (such as ones in push instructions)
+ 	     and it is caller's work to verify whether resulting insn match.  */
+ 	  rtx addr = simplify_replace_rtx (XEXP (x, 0), old, new);
+ 	  rtx mem;
+ 	  if (XEXP (x, 0) != addr)
+ 	    {
+ 	      mem = gen_rtx_MEM (GET_MODE (x), addr);
+ 	      MEM_COPY_ATTRIBUTES (mem, x);
+ 	    }
+ 	  else
+ 	    mem = x;
+ 	  return mem;
+ 	}
+ 
        return x;
      }
  }
  
  /* Try to simplify a unary operation CODE whose output mode is to be



More information about the Gcc-patches mailing list