This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] bb-reorder: Improve compgotos pass (PR71785)
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Steven Bosscher <stevenb dot gcc at gmail dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 2 Nov 2016 08:40:59 -0500
- Subject: Re: [PATCH] bb-reorder: Improve compgotos pass (PR71785)
- Authentication-results: sourceware.org; auth=none
- References: <3d8d886a7e9d7bcf5bee9867e2f4849a210fd976.1477843149.git.segher@kernel.crashing.org> <CABu31nMgGauxDx5XegT28VYprZRAMZdtRm+zoLjpmeV46MkPBQ@mail.gmail.com> <20161031153504.GA3328@gate.crashing.org> <CAFiYyc2d1PC3tjrihuRadbSVKvmEQ++DPSU8y4Rr7E+7_hd36w@mail.gmail.com> <CABu31nN0nVowQspRjnq3DiyWjetMR0ZjAdB+GdZwdW1NCwowfg@mail.gmail.com>
On Wed, Nov 02, 2016 at 11:39:20AM +0100, Steven Bosscher wrote:
> On Wed, Nov 2, 2016 at 10:02 AM, Richard Biener
> <richard.guenther@gmail.com> wrote:
> > On Mon, Oct 31, 2016 at 4:35 PM, Segher Boessenkool wrote:
> >> On Mon, Oct 31, 2016 at 04:09:48PM +0100, Steven Bosscher wrote:
> >>> On Sun, Oct 30, 2016 at 8:10 PM, Segher Boessenkool wrote:
> >>> > + cfg_layout_finalize ();
> >>>
> >>> I don't think you have to go into/out-of cfglayout mode for each iteration.
> >>
> >> Yeah probably. I was too lazy :-) It needs the cleanup_cfg every
> >> iteration though, I was afraid that interacts.
> >
> > Ick. Why would it need a cfg-cleanup every iteration?
>
> I don't believe it needs a cleanup on every iteration. One cleanup at
> the end should work fine.
But as the comment there says:
/* Merge the duplicated blocks into predecessors, when possible. */
cleanup_cfg (0);
(this is not a new comment), and without merging blocks this whole
patch does zilch.
There is no need to create new basic blocks at all (can replace the
final branch in a block with a copy of the whole block it jumps to,
instead); and then it is painfully obvious that switching to layout
mode here is pointless, too.
Do you want me to do that?
Btw, this isn't quadratic anyway; it is a constant number (the maximal
length allowed of the block to copy) linear. Unless there are unboundedly
many forwarder blocks, which there shouldn't be, but I cannot prove that.
And on a testcase with 2000 cases (instead of the 4 in the testcase in
the PR) this pass takes less than 1% of the compiler runtime; and in
the normal cases (no computed gotos to unfactor) it does the same as
before.
Segher