Commit f5843d08 by Richard Guenther Committed by Richard Biener

re PR middle-end/54146 (Very slow compile with attribute((flatten)))

2012-08-16  Richard Guenther  <rguenther@suse.de>

	PR middle-end/54146
	* tree-ssa-loop-niter.c (find_loop_niter_by_eval): Free the
	exit vector.
	* ipa-pure-const.c (analyze_function): Use FOR_EACH_LOOP_BREAK.
	* cfgloop.h (FOR_EACH_LOOP_BREAK): Fix.
	* tree-ssa-structalias.c (handle_lhs_call): Properly free rhsc.
	* tree-into-ssa.c (get_ssa_name_ann): Allocate info only when
	needed.
	* tree-ssa-loop-im.c (analyze_memory_references): Adjust.
	(tree_ssa_lim_finalize): Free all mem_refs.
	* tree-ssa-sccvn.c (extract_and_process_scc_for_name): Free
	scc when bailing out.
	* modulo-sched.c (sms_schedule): Use FOR_EACH_LOOP_BREAK.
	* ira-build.c (loop_with_complex_edge_p): Free loop exit vector.
	* graphite-sese-to-poly.c (scop_ivs_can_be_represented): Use
	FOR_EACH_LOOP_BREAK.

From-SVN: r190445
parent 0c8036f7
2012-08-16 Richard Guenther <rguenther@suse.de>
PR middle-end/54146
* tree-ssa-loop-niter.c (find_loop_niter_by_eval): Free the
exit vector.
* ipa-pure-const.c (analyze_function): Use FOR_EACH_LOOP_BREAK.
* cfgloop.h (FOR_EACH_LOOP_BREAK): Fix.
* tree-ssa-structalias.c (handle_lhs_call): Properly free rhsc.
* tree-into-ssa.c (get_ssa_name_ann): Allocate info only when
needed.
* tree-ssa-loop-im.c (analyze_memory_references): Adjust.
(tree_ssa_lim_finalize): Free all mem_refs.
* tree-ssa-sccvn.c (extract_and_process_scc_for_name): Free
scc when bailing out.
* modulo-sched.c (sms_schedule): Use FOR_EACH_LOOP_BREAK.
* ira-build.c (loop_with_complex_edge_p): Free loop exit vector.
* graphite-sese-to-poly.c (scop_ivs_can_be_represented): Use
FOR_EACH_LOOP_BREAK.
2012-08-16 Diego Novillo <dnovillo@google.com> 2012-08-16 Diego Novillo <dnovillo@google.com>
PR bootstrap/54281 PR bootstrap/54281
......
...@@ -649,7 +649,7 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags) ...@@ -649,7 +649,7 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags)
#define FOR_EACH_LOOP_BREAK(LI) \ #define FOR_EACH_LOOP_BREAK(LI) \
{ \ { \
VEC_free (int, heap, (LI)->to_visit); \ VEC_free (int, heap, (LI).to_visit); \
break; \ break; \
} }
......
...@@ -3122,6 +3122,7 @@ scop_ivs_can_be_represented (scop_p scop) ...@@ -3122,6 +3122,7 @@ scop_ivs_can_be_represented (scop_p scop)
loop_iterator li; loop_iterator li;
loop_p loop; loop_p loop;
gimple_stmt_iterator psi; gimple_stmt_iterator psi;
bool result = true;
FOR_EACH_LOOP (li, loop, 0) FOR_EACH_LOOP (li, loop, 0)
{ {
...@@ -3137,11 +3138,16 @@ scop_ivs_can_be_represented (scop_p scop) ...@@ -3137,11 +3138,16 @@ scop_ivs_can_be_represented (scop_p scop)
if (TYPE_UNSIGNED (type) if (TYPE_UNSIGNED (type)
&& TYPE_PRECISION (type) >= TYPE_PRECISION (long_long_integer_type_node)) && TYPE_PRECISION (type) >= TYPE_PRECISION (long_long_integer_type_node))
return false; {
result = false;
break;
}
} }
if (!result)
FOR_EACH_LOOP_BREAK (li);
} }
return true; return result;
} }
/* Builds the polyhedral representation for a SESE region. */ /* Builds the polyhedral representation for a SESE region. */
......
...@@ -802,7 +802,7 @@ end: ...@@ -802,7 +802,7 @@ end:
if (dump_file) if (dump_file)
fprintf (dump_file, " can not prove finiteness of loop %i\n", loop->num); fprintf (dump_file, " can not prove finiteness of loop %i\n", loop->num);
l->looping =true; l->looping =true;
break; FOR_EACH_LOOP_BREAK (li);
} }
scev_finalize (); scev_finalize ();
} }
......
...@@ -1846,15 +1846,21 @@ loop_with_complex_edge_p (struct loop *loop) ...@@ -1846,15 +1846,21 @@ loop_with_complex_edge_p (struct loop *loop)
edge_iterator ei; edge_iterator ei;
edge e; edge e;
VEC (edge, heap) *edges; VEC (edge, heap) *edges;
bool res;
FOR_EACH_EDGE (e, ei, loop->header->preds) FOR_EACH_EDGE (e, ei, loop->header->preds)
if (e->flags & EDGE_EH) if (e->flags & EDGE_EH)
return true; return true;
edges = get_loop_exit_edges (loop); edges = get_loop_exit_edges (loop);
res = false;
FOR_EACH_VEC_ELT (edge, edges, i, e) FOR_EACH_VEC_ELT (edge, edges, i, e)
if (e->flags & EDGE_COMPLEX) if (e->flags & EDGE_COMPLEX)
return true; {
return false; res = true;
break;
}
VEC_free (edge, heap, edges);
return res;
} }
#endif #endif
......
...@@ -1413,7 +1413,7 @@ sms_schedule (void) ...@@ -1413,7 +1413,7 @@ sms_schedule (void)
if (dump_file) if (dump_file)
fprintf (dump_file, "SMS reached max limit... \n"); fprintf (dump_file, "SMS reached max limit... \n");
break; FOR_EACH_LOOP_BREAK (li);
} }
if (dump_file) if (dump_file)
......
...@@ -312,22 +312,21 @@ get_ssa_name_ann (tree name) ...@@ -312,22 +312,21 @@ get_ssa_name_ann (tree name)
unsigned len = VEC_length (ssa_name_info_p, info_for_ssa_name); unsigned len = VEC_length (ssa_name_info_p, info_for_ssa_name);
struct ssa_name_info *info; struct ssa_name_info *info;
/* Re-allocate the vector at most once per update/into-SSA. */
if (ver >= len) if (ver >= len)
{ VEC_safe_grow_cleared (ssa_name_info_p, heap,
unsigned old_len = VEC_length (ssa_name_info_p, info_for_ssa_name); info_for_ssa_name, num_ssa_names);
unsigned new_len = num_ssa_names;
VEC_reserve (ssa_name_info_p, heap, info_for_ssa_name, /* But allocate infos lazily. */
new_len - old_len); info = VEC_index (ssa_name_info_p, info_for_ssa_name, ver);
while (len++ < new_len) if (!info)
{ {
struct ssa_name_info *info = XCNEW (struct ssa_name_info); info = XCNEW (struct ssa_name_info);
info->age = current_info_for_ssa_name_age; info->age = current_info_for_ssa_name_age;
VEC_quick_push (ssa_name_info_p, info_for_ssa_name, info); info->info.need_phi_state = NEED_PHI_STATE_UNKNOWN;
} VEC_replace (ssa_name_info_p, info_for_ssa_name, ver, info);
} }
info = VEC_index (ssa_name_info_p, info_for_ssa_name, ver);
if (info->age < current_info_for_ssa_name_age) if (info->age < current_info_for_ssa_name_age)
{ {
info->age = current_info_for_ssa_name_age; info->age = current_info_for_ssa_name_age;
......
...@@ -1486,9 +1486,8 @@ free_mem_ref_locs (mem_ref_locs_p accs) ...@@ -1486,9 +1486,8 @@ free_mem_ref_locs (mem_ref_locs_p accs)
/* A function to free the mem_ref object OBJ. */ /* A function to free the mem_ref object OBJ. */
static void static void
memref_free (void *obj) memref_free (struct mem_ref *mem)
{ {
struct mem_ref *const mem = (struct mem_ref *) obj;
unsigned i; unsigned i;
mem_ref_locs_p accs; mem_ref_locs_p accs;
...@@ -1728,8 +1727,7 @@ analyze_memory_references (void) ...@@ -1728,8 +1727,7 @@ analyze_memory_references (void)
unsigned i; unsigned i;
bitmap empty; bitmap empty;
memory_accesses.refs memory_accesses.refs = htab_create (100, memref_hash, memref_eq, NULL);
= htab_create (100, memref_hash, memref_eq, memref_free);
memory_accesses.refs_list = NULL; memory_accesses.refs_list = NULL;
memory_accesses.refs_in_loop = VEC_alloc (bitmap, heap, memory_accesses.refs_in_loop = VEC_alloc (bitmap, heap,
number_of_loops ()); number_of_loops ());
...@@ -2617,6 +2615,7 @@ tree_ssa_lim_finalize (void) ...@@ -2617,6 +2615,7 @@ tree_ssa_lim_finalize (void)
basic_block bb; basic_block bb;
unsigned i; unsigned i;
bitmap b; bitmap b;
mem_ref_p ref;
free_aux_for_edges (); free_aux_for_edges ();
...@@ -2625,9 +2624,12 @@ tree_ssa_lim_finalize (void) ...@@ -2625,9 +2624,12 @@ tree_ssa_lim_finalize (void)
pointer_map_destroy (lim_aux_data_map); pointer_map_destroy (lim_aux_data_map);
VEC_free (mem_ref_p, heap, memory_accesses.refs_list);
htab_delete (memory_accesses.refs); htab_delete (memory_accesses.refs);
FOR_EACH_VEC_ELT (mem_ref_p, memory_accesses.refs_list, i, ref)
memref_free (ref);
VEC_free (mem_ref_p, heap, memory_accesses.refs_list);
FOR_EACH_VEC_ELT (bitmap, memory_accesses.refs_in_loop, i, b) FOR_EACH_VEC_ELT (bitmap, memory_accesses.refs_in_loop, i, b)
BITMAP_FREE (b); BITMAP_FREE (b);
VEC_free (bitmap, heap, memory_accesses.refs_in_loop); VEC_free (bitmap, heap, memory_accesses.refs_in_loop);
......
...@@ -2286,7 +2286,10 @@ find_loop_niter_by_eval (struct loop *loop, edge *exit) ...@@ -2286,7 +2286,10 @@ find_loop_niter_by_eval (struct loop *loop, edge *exit)
/* Loops with multiple exits are expensive to handle and less important. */ /* Loops with multiple exits are expensive to handle and less important. */
if (!flag_expensive_optimizations if (!flag_expensive_optimizations
&& VEC_length (edge, exits) > 1) && VEC_length (edge, exits) > 1)
return chrec_dont_know; {
VEC_free (edge, heap, exits);
return chrec_dont_know;
}
FOR_EACH_VEC_ELT (edge, exits, i, ex) FOR_EACH_VEC_ELT (edge, exits, i, ex)
{ {
......
...@@ -3665,6 +3665,8 @@ extract_and_process_scc_for_name (tree name) ...@@ -3665,6 +3665,8 @@ extract_and_process_scc_for_name (tree name)
fprintf (dump_file, "WARNING: Giving up with SCCVN due to " fprintf (dump_file, "WARNING: Giving up with SCCVN due to "
"SCC size %u exceeding %u\n", VEC_length (tree, scc), "SCC size %u exceeding %u\n", VEC_length (tree, scc),
(unsigned)PARAM_VALUE (PARAM_SCCVN_MAX_SCC_SIZE)); (unsigned)PARAM_VALUE (PARAM_SCCVN_MAX_SCC_SIZE));
VEC_free (tree, heap, scc);
return false; return false;
} }
......
...@@ -3868,9 +3868,11 @@ handle_lhs_call (gimple stmt, tree lhs, int flags, VEC(ce_s, heap) *rhsc, ...@@ -3868,9 +3868,11 @@ handle_lhs_call (gimple stmt, tree lhs, int flags, VEC(ce_s, heap) *rhsc,
tmpc.offset = 0; tmpc.offset = 0;
tmpc.type = ADDRESSOF; tmpc.type = ADDRESSOF;
VEC_safe_push (ce_s, heap, rhsc, &tmpc); VEC_safe_push (ce_s, heap, rhsc, &tmpc);
process_all_all_constraints (lhsc, rhsc);
VEC_free (ce_s, heap, rhsc);
} }
else
process_all_all_constraints (lhsc, rhsc); process_all_all_constraints (lhsc, rhsc);
VEC_free (ce_s, heap, lhsc); VEC_free (ce_s, heap, lhsc);
} }
......
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