PR tree-optimization/34450
* params.def (PARAM_SCCVN_MAX_SCC_SIZE): New param.
* invoke.texi (sccvn-max-scc-size): Document.
* Makefile.in (tree-ssa-sccvn.o): Add $(PARAMS_H) dependency.
* tree-ssa-sccvn.h (run_scc_vn): Return true on success, false
on error.
* tree-ssa-sccvn.c (params.h): Include.
(DFS): Return true if all went well, return false as soon as
a SCC exceeds the size of PARAM_SCCVN_MAX_SCC_SIZE.
(run_scc_vn): Return true if all went well, return false if
we aborted during DFS.
* tree-ssa-pre.c (execute_pre): Check if SCCVN finished
successfully, otherwise bail out.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130895
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-12-13 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/34450
+ * params.def (PARAM_SCCVN_MAX_SCC_SIZE): New param.
+ * invoke.texi (sccvn-max-scc-size): Document.
+ * Makefile.in (tree-ssa-sccvn.o): Add $(PARAMS_H) dependency.
+ * tree-ssa-sccvn.h (run_scc_vn): Return true on success, false
+ on error.
+ * tree-ssa-sccvn.c (params.h): Include.
+ (DFS): Return true if all went well, return false as soon as
+ a SCC exceeds the size of PARAM_SCCVN_MAX_SCC_SIZE.
+ (run_scc_vn): Return true if all went well, return false if
+ we aborted during DFS.
+ * tree-ssa-pre.c (execute_pre): Check if SCCVN finished
+ successfully, otherwise bail out.
+
2007-12-13 Olga Golovanevsky <olga@il.ibm.com>
* ipa-struct-reorg.c (is_candidate): Print information to dump
$(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) \
$(TM_H) coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) $(CFGLOOP_H) \
alloc-pool.h $(BASIC_BLOCK_H) bitmap.h $(HASHTAB_H) $(TREE_GIMPLE_H) \
- $(TREE_INLINE_H) tree-iterator.h tree-ssa-propagate.h tree-ssa-sccvn.h
+ $(TREE_INLINE_H) tree-iterator.h tree-ssa-propagate.h tree-ssa-sccvn.h \
+ $(PARAMS_H)
tree-vn.o : tree-vn.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) \
$(TREE_H) $(TREE_FLOW_H) $(HASHTAB_H) langhooks.h tree-pass.h \
$(TREE_DUMP_H) $(DIAGNOSTIC_H) tree-ssa-sccvn.h
which prevents the runaway behaviour. Setting a value of 0 for
this paramter will allow an unlimited set length.
+@item sccvn-max-scc-size
+Maximum size of a strongly connected component (SCC) during SCCVN
+processing. If this limit is hit, SCCVN processing for the whole
+function will not be done and optimizations depending on it will
+be disabled. The default maximum SCC size is 10000.
+
@end table
@end table
"Maximum length of partial antic set when performing tree pre optimization",
100, 0, 0)
+/* The following is used as a stop-gap limit for cases where really huge
+ SCCs blow up memory and compile-time use too much. If we hit this limit,
+ SCCVN and such FRE and PRE will be not done at all for the current
+ function. */
+
+DEFPARAM (PARAM_SCCVN_MAX_SCC_SIZE,
+ "sccvn-max-scc-size",
+ "Maximum size of a SCC before SCCVN stops processing a function",
+ 10000, 10, 0)
+
+
/*
Local variables:
mode:c
insert_fake_stores ();
/* Collect and value number expressions computed in each basic block. */
- run_scc_vn ();
+ if (!run_scc_vn ())
+ {
+ if (!do_fre)
+ remove_dead_inserted_code ();
+ fini_pre ();
+ return;
+ }
switch_to_PRE_table ();
compute_avail ();
#include "bitmap.h"
#include "langhooks.h"
#include "cfgloop.h"
+#include "params.h"
#include "tree-ssa-propagate.h"
#include "tree-ssa-sccvn.h"
/* Depth first search on NAME to discover and process SCC's in the SSA
graph.
Execution of this algorithm relies on the fact that the SCC's are
- popped off the stack in topological order. */
+ popped off the stack in topological order.
+ Returns true if successful, false if we stopped processing SCC's due
+ to ressource constraints. */
-static void
+static bool
DFS (tree name)
{
ssa_op_iter iter;
if (! (VN_INFO (use)->visited))
{
- DFS (use);
+ if (!DFS (use))
+ return false;
VN_INFO (name)->low = MIN (VN_INFO (name)->low,
VN_INFO (use)->low);
}
VEC_safe_push (tree, heap, scc, x);
} while (x != name);
+ /* Bail out of SCCVN in case a SCC turns out to be incredibly large. */
+ if (VEC_length (tree, scc)
+ > (unsigned)PARAM_VALUE (PARAM_SCCVN_MAX_SCC_SIZE))
+ {
+ if (dump_file)
+ fprintf (dump_file, "WARNING: Giving up with SCCVN due to "
+ "SCC size %u exceeding %u\n", VEC_length (tree, scc),
+ (unsigned)PARAM_VALUE (PARAM_SCCVN_MAX_SCC_SIZE));
+ return false;
+ }
+
if (VEC_length (tree, scc) > 1)
sort_scc (scc);
VEC_free (tree, heap, scc);
}
+
+ return true;
}
static void
}
}
-void
+/* Do SCCVN. Returns true if it finished, false if we bailed out
+ due to ressource constraints. */
+
+bool
run_scc_vn (void)
{
size_t i;
if (name
&& VN_INFO (name)->visited == false
&& !has_zero_uses (name))
- DFS (name);
+ if (!DFS (name))
+ {
+ free_scc_vn ();
+ return false;
+ }
}
if (dump_file && (dump_flags & TDF_DETAILS))
}
}
}
+
+ return true;
}
/* Return the value numbering info for an SSA_NAME. */
extern vn_ssa_aux_t VN_INFO (tree);
extern vn_ssa_aux_t VN_INFO_GET (tree);
-void run_scc_vn (void);
+bool run_scc_vn (void);
void free_scc_vn (void);
void switch_to_PRE_table (void);
tree vn_binary_op_lookup (tree);