public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Schmidt <bschmidt@redhat.com>
To: Segher Boessenkool <segher@kernel.crashing.org>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/4] bb-reorder: Add the "simple" algorithm
Date: Thu, 24 Sep 2015 11:13:00 -0000	[thread overview]
Message-ID: <5603D15B.2090408@redhat.com> (raw)
In-Reply-To: <a691f5437e32cec13ab9f9776975e95be67c4811.1443028412.git.segher@kernel.crashing.org>

On 09/24/2015 12:06 AM, Segher Boessenkool wrote:
> This is the meat of this series: a new algorithm to do basic block
> reordering.  It uses the simple greedy approach to maximum weighted
> matching, where the weights are the predicted execution frequency of
> the edges.  This always finds a solution that is within a factor two
> of optimal, if you disregard loops (which we cannot allow) and the
> complications of block partitioning.

Looks really good for the most part.

The comment at the top of the file should be updated to mention both 
algorithms.

> +  /* Sort the edges, the most desirable first.  */
> +
> +  std::stable_sort (edges, edges + n, edge_order);

Any thoughts on this vs qsort? Do you need a stable sort?

> +  int j;
> +  for (j = 0; j < n; j++)

for (int j ...
here and in the other loop that uses j.

> +  /* If the entry edge no longer falls through we have to make a new
> +     block so it can do so again.  */
> +
> +  edge e = EDGE_SUCC (ENTRY_BLOCK_PTR_FOR_FN (cfun), 0);
> +  if (e->dest != ENTRY_BLOCK_PTR_FOR_FN (cfun)->aux)
> +    {
> +      force_nonfallthru (e);
> +      e->src->aux = ENTRY_BLOCK_PTR_FOR_FN (cfun)->aux;
> +      BB_COPY_PARTITION (e->src, e->dest);
> +    }
> +}

That's a bit odd, can this situation be prevented earlier? Why wouldn't 
we force the entry edge to fall thru?


Bernd

  reply	other threads:[~2015-09-24 10:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 22:09 [PATCH 0/4] " Segher Boessenkool
2015-09-23 22:09 ` [PATCH 1/4] bb-reorder: Split out STC Segher Boessenkool
2015-09-24 16:12   ` Steven Bosscher
2015-09-23 22:10 ` [PATCH 2/4] bb-reorder: Add the "simple" algorithm Segher Boessenkool
2015-09-24 11:13   ` Bernd Schmidt [this message]
2015-09-24 13:48     ` Segher Boessenkool
2015-09-24 15:19       ` Segher Boessenkool
2015-09-24 16:35   ` Steven Bosscher
2015-09-24 17:22     ` Segher Boessenkool
2015-09-25 14:31   ` [PATCH 2/4 v2] " Segher Boessenkool
2015-09-25 16:09     ` Peter Bergner
2015-09-25 16:15       ` Segher Boessenkool
2015-09-29 13:19     ` Bernd Schmidt
2015-09-23 23:01 ` [PATCH 3/4] bb-reorder: Add -freorder-blocks-algorithm= and wire it up Segher Boessenkool
2015-09-24 11:00   ` Bernd Schmidt
2015-09-24 14:06     ` Segher Boessenkool
2015-09-24 15:21   ` Andi Kleen
2015-09-24 15:49     ` Segher Boessenkool
2015-09-24 17:16       ` Segher Boessenkool
     [not found]   ` <56377569.7010904@arm.com>
2015-11-02 15:14     ` Alan Lawrence
2015-11-02 21:04     ` Segher Boessenkool
2015-09-23 23:36 ` [PATCH 4/4] bb-reorder: Documentation updates Segher Boessenkool
2015-09-24 10:33 ` [PATCH 0/4] bb-reorder: Add the "simple" algorithm Bernd Schmidt
2015-09-24 13:32   ` Segher Boessenkool

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=5603D15B.2090408@redhat.com \
    --to=bschmidt@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.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).