This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
overactive optimize_mode_switching
- To: gcc-patches at gcc dot gnu dot org, rth at cygnus dot com
- Subject: overactive optimize_mode_switching
- From: Jan Hubicka <jh at suse dot cz>
- Date: Sat, 27 Oct 2001 19:06:24 +0200
Hi,
optimize_mode_switching works way too hard. It rebuilds the liveness
information even when no changes has been made, that is most commonly the case
on i386.
The checking whether some changes has been made is a bit tricky, as i386 plays
a game by emitting code even for one direction switches, so the seuqneces needs
to be checked for emptyness.
Saves about 3% of bootstrap time. Bootstrapped/regtested i386.
Honza
Sat Oct 27 20:07:12 CEST 2001 Jan Hubicka <jh@suse.cz>
* lcm.c (optimize_mode_switching): Do not rebuild liveness information
when no changes has been made.
*** lcm.c.old Sat Oct 27 20:02:58 2001
--- lcm.c Sat Oct 27 20:05:15 2001
*************** optimize_mode_switching (file)
*** 1029,1034 ****
--- 1029,1035 ----
int i, j;
int n_entities;
int max_num_modes = 0;
+ bool emited = false;
#ifdef NORMAL_MODE
/* Increment n_basic_blocks before allocating bb_info. */
*************** optimize_mode_switching (file)
*** 1239,1248 ****
--- 1240,1255 ----
mode_set = gen_sequence ();
end_sequence ();
+ /* Do not bother to insert empty sequence. */
+ if (GET_CODE (mode_set) == SEQUENCE
+ && !XVECLEN (mode_set, 0))
+ continue;
+
/* If this is an abnormal edge, we'll insert at the end
of the previous block. */
if (eg->flags & EDGE_ABNORMAL)
{
+ emited = true;
if (GET_CODE (src_bb->end) == JUMP_INSN)
emit_insn_before (mode_set, src_bb->end);
/* It doesn't make sense to switch to normal mode
*************** optimize_mode_switching (file)
*** 1313,1322 ****
--- 1320,1335 ----
mode_set = gen_sequence ();
end_sequence ();
+ /* Do not bother to insert empty sequence. */
+ if (GET_CODE (mode_set) == SEQUENCE
+ && !XVECLEN (mode_set, 0))
+ continue;
+
/* If this is an abnormal edge, we'll insert at the end of the
previous block. */
if (eg->flags & EDGE_ABNORMAL)
{
+ emited = true;
if (GET_CODE (eg->src->end) == JUMP_INSN)
emit_insn_before (mode_set, eg->src->end);
else if (GET_CODE (eg->src->end) == INSN)
*************** optimize_mode_switching (file)
*** 1349,1354 ****
--- 1362,1373 ----
mode_set = gen_sequence ();
end_sequence ();
+ /* Do not bother to insert empty sequence. */
+ if (GET_CODE (mode_set) == SEQUENCE
+ && !XVECLEN (mode_set, 0))
+ continue;
+
+ emited = true;
if (GET_CODE (ptr->insn_ptr) == NOTE
&& (NOTE_LINE_NUMBER (ptr->insn_ptr)
== NOTE_INSN_BASIC_BLOCK))
*************** optimize_mode_switching (file)
*** 1375,1380 ****
--- 1394,1402 ----
if (need_commit)
commit_edge_insertions ();
+
+ if (!need_commit && !emited)
+ return 0;
/* Ideally we'd figure out what blocks were affected and start from
there, but this is enormously complicated by commit_edge_insertions,