This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug optimization/8092] [3.3/3.4 regression] cross-jump triggers too often


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]