Commit ec8c3978 by Jakub Jelinek

params.def (PARAM_MAX_VARTRACK_SIZE): New.

	* params.def (PARAM_MAX_VARTRACK_SIZE): New.
	* doc/invoke.texi: Document it.
	* var-tracking.c: Include toplev.h and params.h.
	(vt_find_locations): Return bool indicating success.  Compute
	hash sizes unconditionally.  Check new parameter, report.
	(variable_tracking_main_1): Check vt_find_locations results and
	retry.  Renamed from...
	(variable_tracking_main): ... this.  New wrapper to preserve
	flag_var_tracking_assignments.
	* Makefile.in (var-tracking.o): Adjust dependencies.

	* lib/prune.exp: Prune variable tracking size limit exceeded
	notes.

From-SVN: r156794
parent 1e2ddf80
2010-02-16 Alexandre Oliva <aoliva@redhat.com>
* params.def (PARAM_MAX_VARTRACK_SIZE): New.
* doc/invoke.texi: Document it.
* var-tracking.c: Include toplev.h and params.h.
(vt_find_locations): Return bool indicating success. Compute
hash sizes unconditionally. Check new parameter, report.
(variable_tracking_main_1): Check vt_find_locations results and
retry. Renamed from...
(variable_tracking_main): ... this. New wrapper to preserve
flag_var_tracking_assignments.
* Makefile.in (var-tracking.o): Adjust dependencies.
2010-02-16 Jack Howarth <howarth@bromo.med.uc.edu> 2010-02-16 Jack Howarth <howarth@bromo.med.uc.edu>
Jakub Jelinek <jakub@redhat.com> Jakub Jelinek <jakub@redhat.com>
......
...@@ -3025,7 +3025,7 @@ var-tracking.o : var-tracking.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ ...@@ -3025,7 +3025,7 @@ var-tracking.o : var-tracking.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TREE_H) hard-reg-set.h insn-config.h reload.h $(FLAGS_H) \ $(RTL_H) $(TREE_H) hard-reg-set.h insn-config.h reload.h $(FLAGS_H) \
$(BASIC_BLOCK_H) output.h sbitmap.h alloc-pool.h $(FIBHEAP_H) $(HASHTAB_H) \ $(BASIC_BLOCK_H) output.h sbitmap.h alloc-pool.h $(FIBHEAP_H) $(HASHTAB_H) \
$(REGS_H) $(EXPR_H) $(TIMEVAR_H) $(TREE_PASS_H) $(TREE_FLOW_H) \ $(REGS_H) $(EXPR_H) $(TIMEVAR_H) $(TREE_PASS_H) $(TREE_FLOW_H) \
cselib.h $(TARGET_H) cselib.h $(TARGET_H) $(TOPLEV_H) $(PARAMS_H)
profile.o : profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ profile.o : profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) $(FUNCTION_H) \ $(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) $(FUNCTION_H) \
$(TOPLEV_H) $(COVERAGE_H) $(TREE_FLOW_H) value-prof.h cfghooks.h \ $(TOPLEV_H) $(COVERAGE_H) $(TREE_FLOW_H) value-prof.h cfghooks.h \
......
...@@ -8428,6 +8428,15 @@ with more basic blocks than this parameter won't have loop invariant ...@@ -8428,6 +8428,15 @@ with more basic blocks than this parameter won't have loop invariant
motion optimization performed on them. The default value of the motion optimization performed on them. The default value of the
parameter is 1000 for -O1 and 10000 for -O2 and above. parameter is 1000 for -O1 and 10000 for -O2 and above.
@item max-vartrack-size
Sets a maximum number of hash table slots to use during variable
tracking dataflow analysis of any function. If this limit is exceeded
with variable tracking at assignments enabled, analysis for that
function is retried without it, after removing all debug insns from
the function. If the limit is exceeded even without debug insns, var
tracking analysis is completely disabled for the function. Setting
the parameter to zero makes it unlimited.
@item min-nondebug-insn-uid @item min-nondebug-insn-uid
Use uids starting at this parameter for nondebug insns. The range below Use uids starting at this parameter for nondebug insns. The range below
the parameter is reserved exclusively for debug insns created by the parameter is reserved exclusively for debug insns created by
......
...@@ -764,6 +764,13 @@ DEFPARAM (PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO, ...@@ -764,6 +764,13 @@ DEFPARAM (PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO,
"Min. ratio of insns to mem ops to enable prefetching in a loop", "Min. ratio of insns to mem ops to enable prefetching in a loop",
3, 0, 0) 3, 0, 0)
/* Set maximum hash table size for var tracking. */
DEFPARAM (PARAM_MAX_VARTRACK_SIZE,
"max-vartrack-size",
"Max. size of var tracking hash tables",
50000000, 0, 0)
/* Set minimum insn uid for non-debug insns. */ /* Set minimum insn uid for non-debug insns. */
DEFPARAM (PARAM_MIN_NONDEBUG_INSN_UID, DEFPARAM (PARAM_MIN_NONDEBUG_INSN_UID,
......
2010-02-16 Jakub Jelinek <jakub@redhat.com>
* lib/prune.exp: Prune variable tracking size limit exceeded
notes.
2010-02-16 Jason Merrill <jason@redhat.com> 2010-02-16 Jason Merrill <jason@redhat.com>
PR c++/43031 PR c++/43031
......
...@@ -37,6 +37,9 @@ proc prune_gcc_output { text } { ...@@ -37,6 +37,9 @@ proc prune_gcc_output { text } {
regsub -all "(^|\n)\[^\n\]*: Additional NOP may be necessary to workaround Itanium processor A/B step errata" $text "" text regsub -all "(^|\n)\[^\n\]*: Additional NOP may be necessary to workaround Itanium processor A/B step errata" $text "" text
regsub -all "(^|\n)\[^\n*\]*: Assembler messages:\[^\n\]*" $text "" text regsub -all "(^|\n)\[^\n*\]*: Assembler messages:\[^\n\]*" $text "" text
# Ignore harmless VTA note.
regsub -all "(^|\n)\[^\n\]*: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without\[^\n\]*" $text "" text
# It would be nice to avoid passing anything to gcc that would cause it to # It would be nice to avoid passing anything to gcc that would cause it to
# issue these messages (since ignoring them seems like a hack on our part), # issue these messages (since ignoring them seems like a hack on our part),
# but that's too difficult in the general case. For example, sometimes # but that's too difficult in the general case. For example, sometimes
......
...@@ -109,6 +109,8 @@ ...@@ -109,6 +109,8 @@
#include "tree-flow.h" #include "tree-flow.h"
#include "cselib.h" #include "cselib.h"
#include "target.h" #include "target.h"
#include "toplev.h"
#include "params.h"
/* var-tracking.c assumes that tree code with the same value as VALUE rtx code /* var-tracking.c assumes that tree code with the same value as VALUE rtx code
has no chance to appear in REG_EXPR/MEM_EXPRs and isn't a decl. has no chance to appear in REG_EXPR/MEM_EXPRs and isn't a decl.
...@@ -448,7 +450,7 @@ static int add_uses (rtx *, void *); ...@@ -448,7 +450,7 @@ static int add_uses (rtx *, void *);
static void add_uses_1 (rtx *, void *); static void add_uses_1 (rtx *, void *);
static void add_stores (rtx, const_rtx, void *); static void add_stores (rtx, const_rtx, void *);
static bool compute_bb_dataflow (basic_block); static bool compute_bb_dataflow (basic_block);
static void vt_find_locations (void); static bool vt_find_locations (void);
static void dump_attrs_list (attrs); static void dump_attrs_list (attrs);
static int dump_var_slot (void **, void *); static int dump_var_slot (void **, void *);
...@@ -5510,7 +5512,7 @@ compute_bb_dataflow (basic_block bb) ...@@ -5510,7 +5512,7 @@ compute_bb_dataflow (basic_block bb)
/* Find the locations of variables in the whole function. */ /* Find the locations of variables in the whole function. */
static void static bool
vt_find_locations (void) vt_find_locations (void)
{ {
fibheap_t worklist, pending, fibheap_swap; fibheap_t worklist, pending, fibheap_swap;
...@@ -5521,6 +5523,8 @@ vt_find_locations (void) ...@@ -5521,6 +5523,8 @@ vt_find_locations (void)
int *rc_order; int *rc_order;
int i; int i;
int htabsz = 0; int htabsz = 0;
int htabmax = PARAM_VALUE (PARAM_MAX_VARTRACK_SIZE);
bool success = true;
/* Compute reverse completion order of depth first search of the CFG /* Compute reverse completion order of depth first search of the CFG
so that the data-flow runs faster. */ so that the data-flow runs faster. */
...@@ -5542,7 +5546,7 @@ vt_find_locations (void) ...@@ -5542,7 +5546,7 @@ vt_find_locations (void)
fibheap_insert (pending, bb_order[bb->index], bb); fibheap_insert (pending, bb_order[bb->index], bb);
sbitmap_ones (in_pending); sbitmap_ones (in_pending);
while (!fibheap_empty (pending)) while (success && !fibheap_empty (pending))
{ {
fibheap_swap = pending; fibheap_swap = pending;
pending = worklist; pending = worklist;
...@@ -5565,11 +5569,11 @@ vt_find_locations (void) ...@@ -5565,11 +5569,11 @@ vt_find_locations (void)
SET_BIT (visited, bb->index); SET_BIT (visited, bb->index);
if (dump_file && VTI (bb)->in.vars) if (VTI (bb)->in.vars)
{ {
htabsz htabsz
-= htab_size (shared_hash_htab (VTI (bb)->in.vars)) -= (htab_size (shared_hash_htab (VTI (bb)->in.vars))
+ htab_size (shared_hash_htab (VTI (bb)->out.vars)); + htab_size (shared_hash_htab (VTI (bb)->out.vars)));
oldinsz oldinsz
= htab_elements (shared_hash_htab (VTI (bb)->in.vars)); = htab_elements (shared_hash_htab (VTI (bb)->in.vars));
oldoutsz oldoutsz
...@@ -5633,9 +5637,21 @@ vt_find_locations (void) ...@@ -5633,9 +5637,21 @@ vt_find_locations (void)
} }
changed = compute_bb_dataflow (bb); changed = compute_bb_dataflow (bb);
if (dump_file) htabsz += (htab_size (shared_hash_htab (VTI (bb)->in.vars))
htabsz += htab_size (shared_hash_htab (VTI (bb)->in.vars)) + htab_size (shared_hash_htab (VTI (bb)->out.vars)));
+ htab_size (shared_hash_htab (VTI (bb)->out.vars));
if (htabmax && htabsz > htabmax)
{
if (MAY_HAVE_DEBUG_INSNS)
inform (DECL_SOURCE_LOCATION (cfun->decl),
"variable tracking size limit exceeded with "
"-fvar-tracking-assignments, retrying without");
else
inform (DECL_SOURCE_LOCATION (cfun->decl),
"variable tracking size limit exceeded");
success = false;
break;
}
if (changed) if (changed)
{ {
...@@ -5686,7 +5702,7 @@ vt_find_locations (void) ...@@ -5686,7 +5702,7 @@ vt_find_locations (void)
} }
} }
if (MAY_HAVE_DEBUG_INSNS) if (success && MAY_HAVE_DEBUG_INSNS)
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
gcc_assert (VTI (bb)->flooded); gcc_assert (VTI (bb)->flooded);
...@@ -5697,6 +5713,8 @@ vt_find_locations (void) ...@@ -5697,6 +5713,8 @@ vt_find_locations (void)
sbitmap_free (visited); sbitmap_free (visited);
sbitmap_free (in_worklist); sbitmap_free (in_worklist);
sbitmap_free (in_pending); sbitmap_free (in_pending);
return success;
} }
/* Print the content of the LIST to dump file. */ /* Print the content of the LIST to dump file. */
...@@ -7599,9 +7617,11 @@ vt_finalize (void) ...@@ -7599,9 +7617,11 @@ vt_finalize (void)
/* The entry point to variable tracking pass. */ /* The entry point to variable tracking pass. */
unsigned int static inline unsigned int
variable_tracking_main (void) variable_tracking_main_1 (void)
{ {
bool success;
if (flag_var_tracking_assignments < 0) if (flag_var_tracking_assignments < 0)
{ {
delete_debug_insns (); delete_debug_insns ();
...@@ -7626,7 +7646,31 @@ variable_tracking_main (void) ...@@ -7626,7 +7646,31 @@ variable_tracking_main (void)
} }
} }
vt_find_locations (); success = vt_find_locations ();
if (!success && flag_var_tracking_assignments > 0)
{
vt_finalize ();
delete_debug_insns ();
/* This is later restored by our caller. */
flag_var_tracking_assignments = 0;
vt_initialize ();
if (!frame_pointer_needed && !vt_stack_adjustments ())
gcc_unreachable ();
success = vt_find_locations ();
}
if (!success)
{
vt_finalize ();
vt_debug_insns_local (false);
return 0;
}
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
...@@ -7640,6 +7684,19 @@ variable_tracking_main (void) ...@@ -7640,6 +7684,19 @@ variable_tracking_main (void)
vt_debug_insns_local (false); vt_debug_insns_local (false);
return 0; return 0;
} }
unsigned int
variable_tracking_main (void)
{
unsigned int ret;
int save = flag_var_tracking_assignments;
ret = variable_tracking_main_1 ();
flag_var_tracking_assignments = save;
return ret;
}
static bool static bool
gate_handle_var_tracking (void) gate_handle_var_tracking (void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment