According to Andrew Pinski , the following patch is useless because gcc should
be able to find the optimisation by itself.
Description : function preferable in cse.c can be simplified if we notice
that, at the end of the function :
if (regcost_a != regcost_b)
return regcost_a - regcost_b;
return 0;
So, if regcost_a == regcost_b, we return 0, but in this case (regcost_a -
regcost_b) is also = 0.
There is no need for the test, and (return regcost_a - regcost_b;) wins in
all cases.
This patch remove 3 572 566 useless tests (if regcost_a != regcost_b) when
doing a full bootstrap.
Bootstrap on a cygwin machine based on snapshot from 20050130.
2005-02-08 Christophe Jaillet <[EMAIL PROTECTED]>
* cse.c (preferable): simplify last test to speed up
*** gcc-4.0-20050130/gcc/cse.c Tue Feb 8 23:39:30 2005
--- my_patch/cse.c Tue Feb 8 23:55:02 2005
*************** preferable (int cost_a, int regcost_a, i
*** 836,845 ****
/* Normal operation costs take precedence. */
if (cost_a != cost_b)
return cost_a - cost_b;
/* Only if these are identical consider effects on register pressure.
*/
! if (regcost_a != regcost_b)
! return regcost_a - regcost_b;
! return 0;
}
/* Internal function, to compute cost when X is not a register; called
--- 836,844 ----
/* Normal operation costs take precedence. */
if (cost_a != cost_b)
return cost_a - cost_b;
+
/* Only if these are identical consider effects on register pressure.
*/
! return regcost_a - regcost_b;
}
/* Internal function, to compute cost when X is not a register; called
--
Summary: Missed optimisation
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: christophe dot jaillet at wanadoo dot fr
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19832