From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88730 invoked by alias); 24 Sep 2015 16:12:17 -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 87000 invoked by uid 89); 24 Sep 2015 16:04:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_05,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f42.google.com Received: from mail-la0-f42.google.com (HELO mail-la0-f42.google.com) (209.85.215.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 24 Sep 2015 16:04:16 +0000 Received: by lacao8 with SMTP id ao8so69003133lac.3 for ; Thu, 24 Sep 2015 09:04:12 -0700 (PDT) X-Received: by 10.112.51.142 with SMTP id k14mr127561lbo.76.1443110652380; Thu, 24 Sep 2015 09:04:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.169.85 with HTTP; Thu, 24 Sep 2015 09:03:33 -0700 (PDT) In-Reply-To: References: From: Steven Bosscher Date: Thu, 24 Sep 2015 16:35:00 -0000 Message-ID: Subject: Re: [PATCH 2/4] bb-reorder: Add the "simple" algorithm To: Segher Boessenkool Cc: GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg01879.txt.bz2 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 (cfun), 0); > + > + basic_block bb; > + FOR_EACH_BB_FN (bb, cfun) > + { > + rtx_insn *end = BB_END (bb); > + > + if (computed_jump_p (end) || tablejump_p (end, NULL, NULL)) > + continue; Should handle ASM jumps. > + FOR_ALL_BB_FN (bb, cfun) > + bb->aux = bb; Bit tricky for the ENTRY and EXIT blocks, that are not really basic blocks. After the pass, EXIT should not end up pointing to itself. Maybe use FOR_EACH_BB_FN and set ENTRY separately? Other than that, looks good to me. Ciao! Steven