From: Eric Botcazou <ebotcazou@adacore.com>
To: gcc-patches@gcc.gnu.org
Subject: Small cleanup in RTL expansion
Date: Tue, 02 Jul 2019 09:45:00 -0000 [thread overview]
Message-ID: <3413974.qYVSK5bheN@polaris> (raw)
[-- Attachment #1: Type: text/plain, Size: 665 bytes --]
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 <ebotcazou@adacore.com>
* 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.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 2455 bytes --]
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)
reply other threads:[~2019-07-02 9:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3413974.qYVSK5bheN@polaris \
--to=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).