From 87d8dd6c4599c09fe4da43adac523cf81613217c Mon Sep 17 00:00:00 2001 From: Brad Lucier Date: Thu, 12 Nov 2015 22:27:47 +0000 Subject: [PATCH] Make disabled-optimization warning more informative; increase default max-gcse-memory * gcc/cprop.c (is_too_expensive): Remove. (gcse.h): Include. (one_cprop_pass): Call gcse_or_cprop_is_too_expensive, not is_too_expensive. * gcc/gcse.h (gcse_or_cprop_is_too_expensive): Declare. * gcc/gcse.c (is_too_expensive): Rename to ... (gcse_or_cprop_is_too_expensive): ... this. Expand warning to add required size of max-gcse-memory. (one_pre_gcse_pass): Use it. (one_code_hoisting_pass): Use it. * gcc/params.def (max-gcse-memory): Increase from 50MB to 128MB. From-SVN: r230276 --- gcc/cprop.c | 44 ++------------------------------------------ 1 file changed, 2 insertions(+), 42 deletions(-) (limited to 'gcc/cprop.c') diff --git a/gcc/cprop.c b/gcc/cprop.c index 082f9fd..7f1acc0 100644 --- a/gcc/cprop.c +++ b/gcc/cprop.c @@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "dbgcnt.h" #include "cfgloop.h" +#include "gcse.h" /* An obstack for our working variables. */ @@ -1724,47 +1725,6 @@ bypass_conditional_jumps (void) return changed; } -/* Return true if the graph is too expensive to optimize. PASS is the - optimization about to be performed. */ - -static bool -is_too_expensive (const char *pass) -{ - /* Trying to perform global optimizations on flow graphs which have - a high connectivity will take a long time and is unlikely to be - particularly useful. - - In normal circumstances a cfg should have about twice as many - edges as blocks. But we do not want to punish small functions - which have a couple switch statements. Rather than simply - threshold the number of blocks, uses something with a more - graceful degradation. */ - if (n_edges_for_fn (cfun) > 20000 + n_basic_blocks_for_fn (cfun) * 4) - { - warning (OPT_Wdisabled_optimization, - "%s: %d basic blocks and %d edges/basic block", - pass, n_basic_blocks_for_fn (cfun), - n_edges_for_fn (cfun) / n_basic_blocks_for_fn (cfun)); - - return true; - } - - /* If allocating memory for the cprop bitmap would take up too much - storage it's better just to disable the optimization. */ - if ((n_basic_blocks_for_fn (cfun) - * SBITMAP_SET_SIZE (max_reg_num ()) - * sizeof (SBITMAP_ELT_TYPE)) > MAX_GCSE_MEMORY) - { - warning (OPT_Wdisabled_optimization, - "%s: %d basic blocks and %d registers", - pass, n_basic_blocks_for_fn (cfun), max_reg_num ()); - - return true; - } - - return false; -} - /* Main function for the CPROP pass. */ static int @@ -1775,7 +1735,7 @@ one_cprop_pass (void) /* Return if there's nothing to do, or it is too expensive. */ if (n_basic_blocks_for_fn (cfun) <= NUM_FIXED_BLOCKS + 1 - || is_too_expensive (_ ("const/copy propagation disabled"))) + || gcse_or_cprop_is_too_expensive (_ ("const/copy propagation disabled"))) return 0; global_const_prop_count = local_const_prop_count = 0; -- cgit v1.1