mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-11 12:45:06 +08:00
re PR middle-end/34450 (compile takes up 1.8 GB RAM at -O1)
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. From-SVN: r130895
This commit is contained in:
parent
3905a1b25a
commit
863d2a5760
@ -1,3 +1,19 @@
|
||||
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
|
||||
|
@ -2075,7 +2075,8 @@ tree-ssa-sccvn.o : tree-ssa-sccvn.c $(TREE_FLOW_H) $(CONFIG_H) \
|
||||
$(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
|
||||
|
@ -7182,6 +7182,12 @@ parameter sets a limit on the length of the sets that are computed,
|
||||
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
|
||||
|
||||
|
@ -713,6 +713,17 @@ DEFPARAM (PARAM_MAX_PARTIAL_ANTIC_LENGTH,
|
||||
"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
|
||||
|
@ -3933,7 +3933,13 @@ execute_pre (bool do_fre)
|
||||
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 ();
|
||||
|
||||
|
@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
#include "bitmap.h"
|
||||
#include "langhooks.h"
|
||||
#include "cfgloop.h"
|
||||
#include "params.h"
|
||||
#include "tree-ssa-propagate.h"
|
||||
#include "tree-ssa-sccvn.h"
|
||||
|
||||
@ -1837,9 +1838,11 @@ process_scc (VEC (tree, heap) *scc)
|
||||
/* 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;
|
||||
@ -1870,7 +1873,8 @@ DFS (tree name)
|
||||
|
||||
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);
|
||||
}
|
||||
@ -1899,6 +1903,17 @@ DFS (tree name)
|
||||
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);
|
||||
|
||||
@ -1909,6 +1924,8 @@ DFS (tree name)
|
||||
|
||||
VEC_free (tree, heap, scc);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2074,7 +2091,10 @@ free_scc_vn (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;
|
||||
@ -2100,7 +2120,11 @@ run_scc_vn (void)
|
||||
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))
|
||||
@ -2123,4 +2147,6 @@ run_scc_vn (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ typedef struct vn_ssa_aux
|
||||
/* 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);
|
||||
|
Loading…
Reference in New Issue
Block a user