Fix major typo in cse.c:find_best_addr

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Tue Feb 6 05:01:00 GMT 2001


When a change was made to this function, a ">" accidentally became
a "<" and this has serious performance implications on RISC targets.

Using "<" defeats the major purpose of this routine.  On CISC machines
the address cost and RTL cost are usually the same, so it just picks the
cheapest address, which is usually a register.

The motivation for this function is on RISC machines where the address
cost of all valid addresses is the same.  In that case, we want to choose
the one with the *highest* RTL cost since that will help eliminate the
most RTL elsewhere.  For example, we would replace a pseudo with a sum
of a register (if we are lucky, the frame pointer) and a constant.  That
may remove all uses of the pseudo.

Tue Feb  6 07:54:51 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* cse.c (find_best_addr): Fix typo in computing cost.

*** cse.c	2001/01/12 21:58:56	1.173
--- cse.c	2001/02/06 12:44:36
*************** find_best_addr (insn, loc, mode)
*** 2976,2980 ****
  		    && ((exp_cost = address_cost (p->exp, mode)) < best_addr_cost
  			|| (exp_cost == best_addr_cost
! 			    && (p->cost + 1) >> 1 < best_rtx_cost)))
  		  {
  		    found_better = 1;
--- 2976,2980 ----
  		    && ((exp_cost = address_cost (p->exp, mode)) < best_addr_cost
  			|| (exp_cost == best_addr_cost
! 			    && ((p->cost + 1) >> 1) > best_rtx_cost)))
  		  {
  		    found_better = 1;




More information about the Gcc-patches mailing list