Re: [PATCH 2/4] bb-reorder: Add the "simple" algorithm

2015-09-24 Thread Bernd Schmidt
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

Re: [PATCH 2/4] bb-reorder: Add the "simple" algorithm

2015-09-24 Thread Segher Boessenkool
On Thu, Sep 24, 2015 at 12:32:59PM +0200, Bernd Schmidt wrote: > 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

Re: [PATCH 2/4] bb-reorder: Add the "simple" algorithm

2015-09-24 Thread Segher Boessenkool
On Thu, Sep 24, 2015 at 08:39:30AM -0500, Segher Boessenkool wrote: > > Any thoughts on this vs qsort? Do you need a stable sort? > > We always need stable sorts in GCC; things are not reproducible across > targets with qsort (not every qsort is the same). s/targets/hosts/

Re: [PATCH 2/4] bb-reorder: Add the "simple" algorithm

2015-09-24 Thread Steven Bosscher
On Thu, Sep 24, 2015 at 12:06 AM, Segher Boessenkool wrote: > + /* First, collect all edges that can be optimized by reordering blocks: > + simple jumps and conditional jumps, as well as the function entry edge. > */ > + > + int n = 0; > + edges[n++] = EDGE_SUCC (ENTRY_BLOCK_PTR_FOR_FN

Re: [PATCH 2/4] bb-reorder: Add the "simple" algorithm

2015-09-24 Thread Segher Boessenkool
On Thu, Sep 24, 2015 at 06:03:33PM +0200, Steven Bosscher wrote: > On Thu, Sep 24, 2015 at 12:06 AM, Segher Boessenkool wrote: > > + /* First, collect all edges that can be optimized by reordering blocks: > > + simple jumps and conditional jumps, as well as the function entry > > edge. */ >

[PATCH 2/4] bb-reorder: Add the "simple" algorithm

2015-09-23 Thread Segher Boessenkool
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