From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90709 invoked by alias); 31 Oct 2016 15:10:32 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 90683 invoked by uid 89); 31 Oct 2016 15:10:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-HELO:sk:mail-lf, ciao X-HELO: mail-lf0-f54.google.com Received: from mail-lf0-f54.google.com (HELO mail-lf0-f54.google.com) (209.85.215.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 31 Oct 2016 15:10:30 +0000 Received: by mail-lf0-f54.google.com with SMTP id b81so105365384lfe.1 for ; Mon, 31 Oct 2016 08:10:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=CnoBkmiybge+Ud0ZVfAkxAL0D+b2Me6DbKuxPJWTujQ=; b=LSWREidwI/OVJLbuhdyPfzlk1bqwIrWkWDdl0kVv+2VwvMv3hqpGdnL5b73TJu62wY NG1CWKBxUDeFfR4CVZDY4e2Ffich58pdmoCqIySC7X8BPlUNxhhfELuI92W+RiLP4MlM zS8LCG573IETrhYOtkXtPHFx+M+jCk2WyKBXM9wD4y1Fad700IN1SYyoo6/95Dy5tZRN +v30KAtgITRg8o73R8DEMp/Q0rfmpn+euq/ITh1K2kJIi0typPj6hVERT1ZKx9S+/K4z Sum2w6rkVwgudMCiF7Eg3GUsArBiTo/ajdI1zobv++XUu+NBJ5407klf8YGyxKvXQlEe k30Q== X-Gm-Message-State: ABUngvdZHCKL2f6B52ungNPrN8O/TKVWpnDzV05JaCzjGx29+UD5dzM6MfD8TDtSDUiue5GdJI6pmVe6a6+oyA== X-Received: by 10.25.193.196 with SMTP id r187mr1793859lff.21.1477926628459; Mon, 31 Oct 2016 08:10:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.139.135 with HTTP; Mon, 31 Oct 2016 08:09:48 -0700 (PDT) In-Reply-To: <3d8d886a7e9d7bcf5bee9867e2f4849a210fd976.1477843149.git.segher@kernel.crashing.org> References: <3d8d886a7e9d7bcf5bee9867e2f4849a210fd976.1477843149.git.segher@kernel.crashing.org> From: Steven Bosscher Date: Mon, 31 Oct 2016 15:10:00 -0000 Message-ID: Subject: Re: [PATCH] bb-reorder: Improve compgotos pass (PR71785) To: Segher Boessenkool Cc: GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-10/txt/msg02488.txt.bz2 On Sun, Oct 30, 2016 at 8:10 PM, Segher Boessenkool wrote: > This patch solves this problem by simply running the duplicate_computed_gotos > pass again, as long as it does any work. The patch looks much bigger than > it is, because I factored out two routines to simplify the control flow. It's made the patch a bit difficult to read. Condensing it a bit... > + for (;;) > { > + if (n_basic_blocks_for_fn (fun) <= NUM_FIXED_BLOCKS + 1) > + return 0; This test should not be needed in the loop. This pass can never collapse the function to a single basic block. > + clear_bb_flags (); > + cfg_layout_initialize (0); See comment below... > + basic_block bb; > + FOR_EACH_BB_FN (bb, fun) > + { > + /* Build the reorder chain for the original order of blocks. */ > + if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (fun)) > + bb->aux = bb->next_bb; > + } > > + duplicate_computed_gotos_find_candidates (fun, candidates, max_size); > > + bool changed = false; > + if (!bitmap_empty_p (candidates)) > + changed = duplicate_computed_gotos_do_duplicate (fun, candidates); > > + if (changed) > + fixup_partitions (); > + > + cfg_layout_finalize (); I don't think you have to go into/out-of cfglayout mode for each iteration. > /* Merge the duplicated blocks into predecessors, when possible. */ > + if (changed) > + cleanup_cfg (0); > + else > + break; > } Maybe a gcc_assert that the loop doesn't iterate more often than num_edges? Ciao! Steven