This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/8092] [3.3/3.4 regression] cross-jump triggers too often
- From: "bernd dot paysan at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Dec 2003 21:11:55 -0000
- Subject: [Bug optimization/8092] [3.3/3.4 regression] cross-jump triggers too often
- References: <20020930012601.8092.bernd.paysan@gmx.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bernd dot paysan at gmx dot de 2003-12-26 21:11 -------
The "too often" triggered crossjumping has partly been resolved with the
-fno-crossjumping option. However, this doesn't include computed gotos, GCC
still produces (from 3.3 on) crossjumps to computed gotos. Looking closer at
the code, this is intentional. The following patch fixes the problem when you
don't want crossjumping by not emitting a central dispatcher for computed
gotos. A central dispatcher is *bad*, because the branch predictor can not make
up any correlation between jump location and jump target.
--- gcc-3.4-20031217/gcc/stmt.c.orig 2003-12-05 12:11:05.000000000 +0100
+++ gcc-3.4-20031217/gcc/stmt.c 2003-12-26 21:54:32.000000000 +0100
@@ -523,7 +523,15 @@
emit_queue ();
- if (! cfun->computed_goto_common_label)
+ if (!flag_crossjumping)
+ {
+ emit_queue ();
+ do_pending_stack_adjust ();
+ emit_indirect_jump (x);
+
+ current_function_has_computed_jump = 1;
+ }
+ else if (! cfun->computed_goto_common_label)
{
cfun->computed_goto_common_reg = copy_to_mode_reg (Pmode, x);
cfun->computed_goto_common_label = gen_label_rtx ();
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8092