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]
Other format: [Raw text]

Sped up predicate in cse.c


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 <christophe.jaillet@wanadoo.fr>

    * 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






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