public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Bernd Paysan <bernd.paysan@gmx.de>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: optimization/8092: cross-jump triggers too often
Date: Sat, 05 Oct 2002 14:36:00 -0000	[thread overview]
Message-ID: <20021005213600.26818.qmail@sources.redhat.com> (raw)

The following reply was made to PR optimization/8092; it has been noted by GNATS.

From: Bernd Paysan <bernd.paysan@gmx.de>
To: anton@mips.complang.tuwien.ac.at,
	Anton Ertl <anton@a0.complang.tuwien.ac.at>, rth@gcc.gnu.org,
	gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, obody@gcc.gnu.org,
	gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: optimization/8092: cross-jump triggers too often
Date: Sat, 5 Oct 2002 22:44:35 +0200

 On Saturday 05 October 2002 11:57, Anton Ertl wrote:
 > 1) Add a -fno-cross-jump flag or similar, as in Bernd's patch.
 
 I had a closer look to the cross-jump code, and it does indeed add a cros=
 sjump=20
 to every single equivalent insn it finds (which is stupid - jumps are mor=
 e=20
 expensive than single instructions). I added another flag as experiment,=20
 -fcross-jump-min=3D<n>, which eliminates cross-jumps for less than n insn=
 s.=20
 However, due to the way the crossjump search works, this increases compil=
 e=20
 time by quite a lot, due to the O(n=B2) order of the crossjump comparison=
 =20
 algorithm. It's probably cheaper to first do the crossjump optimization, =
 and=20
 then to clean up those that weren't cost-efficient (tail-duplication).
 
 And tell me how cross-jump is a performance optimization. I can only see =
 it as=20
 possible size optimization, but these should only be turned on with -Os.
 
 --- gcc-3.2/gcc/cfgcleanup.c.orig=092002-10-05 22:15:17.000000000 +0200
 +++ gcc-3.2/gcc/cfgcleanup.c=092002-10-05 22:16:45.000000000 +0200
 @@ -1278,6 +1278,7 @@
       edge e1, e2;
  {
    int nmatch;
 +  extern int cross_jump_min;
    basic_block src1 =3D e1->src, src2 =3D e2->src;
    basic_block redirect_to;
    rtx newpos1, newpos2;
 @@ -1323,7 +1324,7 @@
 =20
    /* ... and part the second.  */
    nmatch =3D flow_find_cross_jump (mode, src1, src2, &newpos1, &newpos2)=
 ;
 -  if (!nmatch)
 +  if (nmatch < cross_jump_min)
      return false;
 =20
    /* Avoid splitting if possible.  */
 --- gcc-3.2/gcc/toplev.c.orig=092002-05-27 07:48:15.000000000 +0200
 +++ gcc-3.2/gcc/toplev.c=092002-10-05 22:16:47.000000000 +0200
 @@ -610,6 +610,11 @@
 =20
  int flag_syntax_only =3D 0;
 =20
 +/* Nonzero means perform crossjump optimization. */
 +
 +static int flag_crossjump =3D 0;
 +int cross_jump_min;
 +
  /* Nonzero means perform global cse.  */
 =20
  static int flag_gcse;
 @@ -1023,6 +1028,8 @@
     N_("Return 'short' aggregates in registers") },
    {"delayed-branch", &flag_delayed_branch, 1,
     N_("Attempt to fill delay slots of branch instructions") },
 +  {"cross-jump", &flag_crossjump, 1,
 +   N_("Perform crossjump optimization") },
    {"gcse", &flag_gcse, 1,
     N_("Perform the global common subexpression elimination") },
    {"gcse-lm", &flag_gcse_lm, 1,
 @@ -3286,7 +3293,7 @@
    /* Cross-jumping is O(N^3) on the number of edges, thus trying to
       perform cross-jumping on flow graphs which have a high connectivity
       will take a long time.  This is similar to the test to disable GCSE=
 =2E  */
 -  cleanup_crossjump =3D CLEANUP_CROSSJUMP;
 +  cleanup_crossjump =3D flag_crossjump ? CLEANUP_CROSSJUMP : 0;
    if (n_basic_blocks > 1000 && n_edges / n_basic_blocks >=3D 20)
      {
        if (optimize && warn_disabled_optimization)
 @@ -3907,6 +3914,8 @@
    else if ((option_value =3D skip_leading_substring (arg, "align-labels=3D=
 ")))
      align_labels
        =3D read_integral_parameter (option_value, arg - 2, align_labels);
 +  else if ((option_value =3D skip_leading_substring (arg, "cross-jump-mi=
 n=3D")))
 +    cross_jump_min =3D read_integral_parameter (option_value, arg - 2,=20
 cross_jump_min);
    else if ((option_value
  =09    =3D skip_leading_substring (arg, "stack-limit-register=3D")))
      {
 @@ -4701,6 +4710,8 @@
        flag_optimize_sibling_calls =3D 1;
        flag_cse_follow_jumps =3D 1;
        flag_cse_skip_blocks =3D 1;
 +      flag_crossjump =3D 1;
 +      cross_jump_min =3D 1;
        flag_gcse =3D 1;
        flag_expensive_optimizations =3D 1;
        flag_strength_reduce =3D 1;
 -------------------------------------------------------------------------=
 ---
 
 --=20
 Bernd Paysan
 "If you want it done right, you have to do it yourself"
 http://www.jwdt.com/~paysan/
 


             reply	other threads:[~2002-10-05 21:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-05 14:36 Bernd Paysan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-02-26 18:06 Jorge Acereda Maciá
2003-02-23 21:10 neroden
2002-10-07  4:26 Bernd Paysan
2002-10-06 15:26 Daniel Berlin
2002-10-06 12:46 Bernd Paysan
2002-10-05  3:06 Anton Ertl
2002-10-03 16:16 Bernd Paysan
2002-10-01 11:56 Richard Henderson
2002-10-01  7:46 Bernd Paysan
2002-09-30 14:20 rth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021005213600.26818.qmail@sources.redhat.com \
    --to=bernd.paysan@gmx.de \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).