From patchwork Tue Jul 2 09:45:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1126104 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-504150-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="vTtKB9Rx"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45dK9k5m2Nz9s00 for ; Tue, 2 Jul 2019 19:45:46 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=DPtraQlOU0a6srOY vID7Dxw880X14qp8z3vTP8Gh9O9VN0yUH1mGpj4KFxhwZcV07+paXgiO4fLkG/34 1HxrnM1YKiEgYBv8dqCK+qY9RwtY9h48tH2Jz/pffWlRhPiZVxbt65Fc0t/c6Lqz CpMLDIw2zk3+r9vyr+KDyCeX1vk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=ozm4W/viJnNIxZRtrp3y60 v31Gs=; b=vTtKB9RxQV56/ylrfOcQNmnlc1V7k3Iqa9tuxT0eAXVhwXkdeB+5s+ yz2OxczFCwQvRmD57Z7s+8+0qlCySAB8E5VhVTc+D7hFym/GgHiuwmme7Pwey7ms FuqNhL1ZkF7ia8gt8nPYu/ABBuYSG1bQbTPPAqHsaWgjp/tValRNc= Received: (qmail 30844 invoked by alias); 2 Jul 2019 09:45:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 30694 invoked by uid 89); 2 Jul 2019 09:45:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=birth, fun X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 02 Jul 2019 09:45:25 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 0C03F8137A for ; Tue, 2 Jul 2019 11:45:19 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2JqUex53EK55 for ; Tue, 2 Jul 2019 11:45:18 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id DF16F812FD for ; Tue, 2 Jul 2019 11:45:18 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Small cleanup in RTL expansion Date: Tue, 02 Jul 2019 11:45:18 +0200 Message-ID: <3413974.qYVSK5bheN@polaris> MIME-Version: 1.0 pass_expand::execute does the same job as commit_edge_insertions but manually, except for a special case if the entry block has a single successor. But we can extract the special case and just call commit_edge_insertions afterwards. Tested on x86_64-suse-linux, applied on the mainline. 2019-07-02 Eric Botcazou * cfgexpand.c (pass_expand::execute): Deal specially with instructions to be inserted on single successor edge of the entry block. Then call commit_edge_insertions instead of inserting the instructions manually. * cfgrtl.c (commit_edge_insertions): Do not verify flow info during RTL expansion. Index: cfgexpand.c =================================================================== --- cfgexpand.c (revision 272891) +++ cfgexpand.c (working copy) @@ -6576,37 +6576,27 @@ pass_expand::execute (function *fun) split edges which edge insertions might do. */ rebuild_jump_labels (get_insns ()); - FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (fun), - EXIT_BLOCK_PTR_FOR_FN (fun), next_bb) + /* If we have a single successor to the entry block, put the pending insns + after parm birth, but before NOTE_INSNS_FUNCTION_BEG. */ + if (single_succ_p (ENTRY_BLOCK_PTR_FOR_FN (fun))) { - edge e; - edge_iterator ei; - for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); ) + edge e = single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (fun)); + if (e->insns.r) { - if (e->insns.r) - { - rebuild_jump_labels_chain (e->insns.r); - /* Put insns after parm birth, but before - NOTE_INSNS_FUNCTION_BEG. */ - if (e->src == ENTRY_BLOCK_PTR_FOR_FN (fun) - && single_succ_p (ENTRY_BLOCK_PTR_FOR_FN (fun))) - { - rtx_insn *insns = e->insns.r; - e->insns.r = NULL; - if (NOTE_P (parm_birth_insn) - && NOTE_KIND (parm_birth_insn) == NOTE_INSN_FUNCTION_BEG) - emit_insn_before_noloc (insns, parm_birth_insn, e->dest); - else - emit_insn_after_noloc (insns, parm_birth_insn, e->dest); - } - else - commit_one_edge_insertion (e); - } + rtx_insn *insns = e->insns.r; + e->insns.r = NULL; + rebuild_jump_labels_chain (insns); + if (NOTE_P (parm_birth_insn) + && NOTE_KIND (parm_birth_insn) == NOTE_INSN_FUNCTION_BEG) + emit_insn_before_noloc (insns, parm_birth_insn, e->dest); else - ei_next (&ei); + emit_insn_after_noloc (insns, parm_birth_insn, e->dest); } } + /* Otherwise, as well as for other edges, take the usual way. */ + commit_edge_insertions (); + /* We're done expanding trees to RTL. */ currently_expanding_to_rtl = 0; Index: cfgrtl.c =================================================================== --- cfgrtl.c (revision 272891) +++ cfgrtl.c (working copy) @@ -2105,7 +2105,8 @@ commit_edge_insertions (void) which will be done by fixup_partitions. */ fixup_partitions (); - checking_verify_flow_info (); + if (!currently_expanding_to_rtl) + checking_verify_flow_info (); FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun), EXIT_BLOCK_PTR_FOR_FN (cfun), next_bb)