From f0ed4cfb9d55717e36c3c056f612e7323facc7ff Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 5 Nov 2007 15:42:30 +0000 Subject: re PR tree-optimization/32540 (Exponential time behavior in PRE) 2007-11-05 Nick Clifton Sebastian Pop PR tree-optimization/32540 PR tree-optimization/33922 * doc/invoke.texi: Document PARAM_MAX_PARTIAL_ANTIC_LENGTH. * tree-ssa-pre.c: Include params.h. (compute_partial_antic_aux): Use PARAM_MAX_PARTIAL_ANTIC_LENGTH to limit the maximum length of the PA set for a given block. * Makefile.in: Add a dependency upon params.h for tree-ssa-pre.c * params.def (PARAM_MAX_PARTIAL_ANTIC_LENGTH): New parameter. * gcc.dg/tree-ssa/pr32540-1.c: New. * gcc.dg/tree-ssa/pr32540-2.c: New. * gcc.dg/tree-ssa/pr33922.c: New. Co-Authored-By: Sebastian Pop From-SVN: r129901 --- gcc/tree-ssa-pre.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gcc/tree-ssa-pre.c') diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 6203467..59396fd 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "cfgloop.h" #include "tree-ssa-sccvn.h" +#include "params.h" /* TODO: @@ -1839,6 +1840,7 @@ compute_partial_antic_aux (basic_block block, bitmap_set_t PA_OUT; edge e; edge_iterator ei; + unsigned long max_pa = PARAM_VALUE (PARAM_MAX_PARTIAL_ANTIC_LENGTH); old_PA_IN = PA_OUT = NULL; @@ -1847,6 +1849,14 @@ compute_partial_antic_aux (basic_block block, if (block_has_abnormal_pred_edge) goto maybe_dump_sets; + /* If there are too many partially anticipatable values in the + block, phi_translate_set can take an exponential time: stop + before the translation starts. */ + if (max_pa + && single_succ_p (block) + && bitmap_count_bits (PA_IN (single_succ (block))->values) > max_pa) + goto maybe_dump_sets; + old_PA_IN = PA_IN (block); PA_OUT = bitmap_set_new (); -- cgit v1.1