From db6556348d92709dfaa930251b5aa0fd5cb740c3 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 11 Oct 2002 22:26:50 +0200 Subject: [PATCH] re PR c/7344 (performance regression on huge case statements) * 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 | 13 +++++++++++++ gcc/calls.c | 3 +-- gcc/cfgbuild.c | 2 +- gcc/cfgcleanup.c | 5 +++-- gcc/function.c | 2 ++ gcc/function.h | 4 ++++ 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index da1b3f54a5f..6a8f85a7012 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +Fri Oct 11 22:22:38 CEST 2002 Jan Hubicka + + * 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 * sh.md (movv8qi_i+2): For V8QI destinations, generate V4HI diff --git a/gcc/calls.c b/gcc/calls.c index d706751c162..903ddc17fe9 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -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. */ diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c index 97552f9afd9..9ac758b2809 100644 --- a/gcc/cfgbuild.c +++ b/gcc/cfgbuild.c @@ -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); diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index c706ed774e4..594eb5cebd7 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -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 diff --git a/gcc/function.c b/gcc/function.c index d39fca3b4f9..479ecef4141 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -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) (); diff --git a/gcc/function.h b/gcc/function.h index c7a5e5e7e3b..89319ebf2e3 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -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. */ -- 2.30.2