]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/7344 (performance regression on huge case statements)
authorJan Hubicka <jh@suse.cz>
Fri, 11 Oct 2002 20:26:50 +0000 (22:26 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Fri, 11 Oct 2002 20:26:50 +0000 (20:26 +0000)
* calls.c (expand_call): Simplify noreturn call.

PR c/7344
* cfgbuild.c (make_edges): Create edge cache when we do have
large jumptable.
(do_tablejump): Note size of maximal jumptable.
* function.c (prepare_function_start): Zero out size.
* function.h (function): Add max_jumptable_ents.

* cfgcleanup.c (insn_match_p): Verify sibcall flag for calls to.

From-SVN: r58063

gcc/ChangeLog
gcc/calls.c
gcc/cfgbuild.c
gcc/cfgcleanup.c
gcc/function.c
gcc/function.h

index da1b3f54a5f94a18a97e6d628e21c194bb428233..6a8f85a7012517508bf9323c48a668e5388e4114 100644 (file)
@@ -1,3 +1,16 @@
+Fri Oct 11 22:22:38 CEST 2002  Jan Hubicka  <jh@suse.cz>
+
+       * calls.c (expand_call): Simplify noreturn call.
+
+       PR c/7344
+       * cfgbuild.c (make_edges): Create edge cache when we do have
+       large jumptable.
+       (do_tablejump): Note size of maximal jumptable.
+       * function.c (prepare_function_start): Zero out size.
+       * function.h (function): Add max_jumptable_ents.
+
+       * cfgcleanup.c (insn_match_p): Verify sibcall flag for calls to.
+
 Fri Oct 11 12:34:33 2002  J"orn Rennecke <joern.rennecke@superh.com>
 
        * sh.md (movv8qi_i+2): For V8QI destinations, generate V4HI
index d706751c16265b5900811e7a661a353806e11da2..903ddc17fe9bb215d2110e58c6fba68073f81918 100644 (file)
@@ -2459,8 +2459,7 @@ expand_call (exp, target, ignore)
         reload insns generated to fix things up would appear
         before the sibcall_epilogue.  */
       || fndecl == NULL_TREE
-      || (flags & (ECF_RETURNS_TWICE | ECF_LONGJMP))
-      || TREE_THIS_VOLATILE (fndecl)
+      || (flags & (ECF_RETURNS_TWICE | ECF_LONGJMP | ECF_NORETURN))
       || !FUNCTION_OK_FOR_SIBCALL (fndecl)
       /* If this function requires more stack slots than the current
         function, we cannot change it into a sibling call.  */
index 97552f9afd9a5412c4ce8dbe3269e206c5a0aaf8..9ac758b28095dd3074eb68f6804c7a75e372344d 100644 (file)
@@ -292,7 +292,7 @@ make_edges (label_value_list, min, max, update_p)
   /* Heavy use of computed goto in machine-generated code can lead to
      nearly fully-connected CFGs.  In that case we spend a significant
      amount of time searching the edge lists for duplicates.  */
-  if (forced_labels || label_value_list)
+  if (forced_labels || label_value_list || cfun->max_jumptable_ents > 100)
     {
       edge_cache = sbitmap_vector_alloc (last_basic_block, last_basic_block);
       sbitmap_vector_zero (edge_cache, last_basic_block);
index c706ed774e4be1fb0524d579129d9d7346ed6b14..594eb5cebd7ed4a2922ad9c54294887ed44c0b64 100644 (file)
@@ -911,8 +911,9 @@ insns_match_p (mode, i1, i2)
      equal, they were constructed identically.  */
 
   if (GET_CODE (i1) == CALL_INSN
-      && !rtx_equal_p (CALL_INSN_FUNCTION_USAGE (i1),
-                      CALL_INSN_FUNCTION_USAGE (i2)))
+      && (!rtx_equal_p (CALL_INSN_FUNCTION_USAGE (i1),
+                       CALL_INSN_FUNCTION_USAGE (i2))
+         || SIBLING_CALL_P (i1) != SIBLING_CALL_P (i2)))
     return false;
 
 #ifdef STACK_REGS
index d39fca3b4f92781a504342af55891e0d28b8feca..479ecef4141a931b905b3a372b82813090b4cfb6 100644 (file)
@@ -6295,6 +6295,8 @@ prepare_function_start ()
 
   cfun->function_frequency = FUNCTION_FREQUENCY_NORMAL;
 
+  cfun->max_jumptable_ents = 0;
+
   (*lang_hooks.function.init) (cfun);
   if (init_machine_status)
     cfun->machine = (*init_machine_status) ();
index c7a5e5e7e3bf6ffc1320fb6c6c2a2737331e8bcb..89319ebf2e355980858515f1b00b63b9d64e031f 100644 (file)
@@ -500,6 +500,10 @@ struct function GTY(())
        (set only when profile feedback is available).  */
     FUNCTION_FREQUENCY_HOT
   } function_frequency;
+
+  /* Maximal number of entities in the single jumptable.  Used to estimate
+     final flowgraph size.  */
+  int max_jumptable_ents;
 };
 
 /* The function currently being compiled.  */