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]

Re: [PATCH] Add minimum insn match to crossjump





> The following patch imposes a minimum threshhold on the number of
> instructions to match before proceeding with the crossjump optimization
in
> cases where the block we're crossjumping from is not totally matched.
The
> thought here is to make sure there is some minimum number of instructions
> in the new block to make adding an extra branch along the one path worth
> while, it should also give the scheduler a little more to work with in
the
> new block.  Runs of SPECInt and Skidmarks showed some minor improvement.
>
> I've bootstrapped/regtested on powerpc64-unknown-linux-gnu with no
> regressions.
>
> OK for mainline?
>
> -Pat


Here's the reworked patch after parameterizing the magic number for the
minimum instructions to match.

Bootstrapped/regtested on powerpc64-unknown-linux-gnu.


2004-07-06  Pat Haugen  <pthaugen@us.ibm.com>

      * params.def (PARAM_MIN_CROSSJUMP_INSNS): New.
      * cfgcleanup.c (try_crossjump_to_edge): Add minimum insn match
      threshhold.
      * doc/invoke.texi (param): Document min-crossjump-insns.

Index: gcc/params.def
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/params.def,v
retrieving revision 1.41
diff -c -3 -p -r1.41 params.def
*** gcc/params.def      25 May 2004 12:54:54 -0000    1.41
--- gcc/params.def      6 Jul 2004 13:39:36 -0000
*************** DEFPARAM(PARAM_MAX_CROSSJUMP_EDGES,
*** 297,302 ****
--- 297,307 ----
       "max-crossjump-edges",
       "The maximum number of incoming edges to consider for crossjumping",
       100)
+ /* The minimum number of matching instructions to consider for crossjumping.  */
+ DEFPARAM(PARAM_MIN_CROSSJUMP_INSNS,
+      "min-crossjump-insns",
+      "The minimum number of matching instructions to consider for crossjumping",
+      5)

  /* The maximum length of path considered in cse.  */
  DEFPARAM(PARAM_MAX_CSE_PATH_LENGTH,
Index: gcc/cfgcleanup.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.118
diff -c -3 -p -r1.118 cfgcleanup.c
*** gcc/cfgcleanup.c    16 Jun 2004 18:03:11 -0000    1.118
--- gcc/cfgcleanup.c    6 Jul 2004 13:39:36 -0000
*************** try_crossjump_to_edge (int mode, edge e1
*** 1528,1534 ****

    /* ... and part the second.  */
    nmatch = flow_find_cross_jump (mode, src1, src2, &newpos1, &newpos2);
!   if (!nmatch)
      return false;

  #ifndef CASE_DROPS_THROUGH
--- 1528,1540 ----

    /* ... and part the second.  */
    nmatch = flow_find_cross_jump (mode, src1, src2, &newpos1, &newpos2);
!
!   /* Don't proceed with the crossjump unless we found a sufficient number
!      of matching instructions or the 'from' block was totally matched
!      (such that its predecessors will hopefully be redirected and the
!      block removed).  */
!   if ((nmatch < PARAM_VALUE (PARAM_MIN_CROSSJUMP_INSNS))
!       && (newpos1 != BB_HEAD (src1)))
      return false;

  #ifndef CASE_DROPS_THROUGH
Index: gcc/doc/invoke.texi
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.474
diff -c -3 -p -r1.474 invoke.texi
*** gcc/doc/invoke.texi 29 Jun 2004 01:53:04 -0000    1.474
--- gcc/doc/invoke.texi 6 Jul 2004 13:39:47 -0000
*************** the number of edges incoming to each blo
*** 5049,5054 ****
--- 5049,5060 ----
  more aggressive optimization, making the compile time increase with
  probably small improvement in executable size.

+ @item min-crossjump-insns
+ The minimum number of instructions which must be matched at the end
+ of two blocks before crossjumping will be performed on them.  This
+ value is ignored in the case where all instructions in the block being
+ crossjumped from are matched.  The default value is 5.
+
  @item max-delay-slot-insn-search
  The maximum number of instructions to consider when looking for an
  instruction to fill a delay slot.  If more than this arbitrary number of


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