On Mon, 4 Mar 2013, Jakub Jelinek wrote: > Hi! > > This function was releasing only some vectors pushed into queues vector, not > all, and wasn't releasing bounds vector. Fixed thusly. There is no need to > use a typedef for the C++ish vec.h vectors, and the code can be tiny bit > simplified. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Ok. Thanks, Richard. > 2013-03-04 Jakub Jelinek <ja...@redhat.com> > > PR middle-end/56461 > * tree-ssa-loop-niter.c (bb_queue): Remove typedef. > (discover_iteration_bound_by_body_walk): Change queues to > vec<vec<basic_block> > and queue to vec<basic_block>. Fix up > spelling in comment. Call safe_push on queues[bound_index] directly. > Release queues[queue_index] in every iteration unconditionally. > Release bounds vector. > > --- gcc/tree-ssa-loop-niter.c.jj 2013-02-27 23:05:07.000000000 +0100 > +++ gcc/tree-ssa-loop-niter.c 2013-03-04 14:57:37.380872029 +0100 > @@ -3007,9 +3007,6 @@ bound_index (vec<double_int> bounds, dou > gcc_unreachable (); > } > > -/* Used to hold vector of queues of basic blocks bellow. */ > -typedef vec<basic_block> bb_queue; > - > /* We recorded loop bounds only for statements dominating loop latch (and > thus > executed each loop iteration). If there are any bounds on statements not > dominating the loop latch we can improve the estimate by walking the loop > @@ -3022,8 +3019,8 @@ discover_iteration_bound_by_body_walk (s > pointer_map_t *bb_bounds; > struct nb_iter_bound *elt; > vec<double_int> bounds = vNULL; > - vec<bb_queue> queues = vNULL; > - bb_queue queue = bb_queue(); > + vec<vec<basic_block> > queues = vNULL; > + vec<basic_block> queue = vNULL; > ptrdiff_t queue_index; > ptrdiff_t latch_index = 0; > pointer_map_t *block_priority; > @@ -3096,7 +3093,7 @@ discover_iteration_bound_by_body_walk (s > present in the path and we look for path with largest smallest bound > on it. > > - To avoid the need for fibonaci heap on double ints we simply compress > + To avoid the need for fibonacci heap on double ints we simply compress > double ints into indexes to BOUNDS array and then represent the queue > as arrays of queues for every index. > Index of BOUNDS.length() means that the execution of given BB has > @@ -3162,16 +3159,11 @@ discover_iteration_bound_by_body_walk (s > } > > if (insert) > - { > - bb_queue queue2 = queues[bound_index]; > - queue2.safe_push (e->dest); > - queues[bound_index] = queue2; > - } > + queues[bound_index].safe_push (e->dest); > } > } > } > - else > - queues[queue_index].release (); > + queues[queue_index].release (); > } > > gcc_assert (latch_index >= 0); > @@ -3187,6 +3179,7 @@ discover_iteration_bound_by_body_walk (s > } > > queues.release (); > + bounds.release (); > pointer_map_destroy (bb_bounds); > pointer_map_destroy (block_priority); > } > > Jakub > > -- Richard Biener <rguent...@suse.de> SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imend