tree-predcom.c (filter_suitable_components): Free all refs in act->refs vector before...
authorJakub Jelinek <jakub@gcc.gnu.org>
Mon, 15 Sep 2008 21:55:05 +0000 (23:55 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 15 Sep 2008 21:55:05 +0000 (23:55 +0200)
* tree-predcom.c (filter_suitable_components): Free all refs in
act->refs vector before calling release_component.
(add_ref_to_chain): Free ref if not adding it to chain->refs.

* tree-data-ref.c (free_subscripts): Free all subscript objects.

* tree-loop-linear.c (linear_transform_loops): Initialize
lambda_obstack only after calling perfect_loop_nest_depth.
Goto free_and_continue instead of just continue for later failures.

From-SVN: r140376

gcc/tree-data-ref.c
gcc/tree-loop-linear.c
gcc/tree-predcom.c

index 2be0ad1..5a52d26 100644 (file)
@@ -1398,6 +1398,7 @@ free_subscripts (VEC (subscript_p, heap) *subscripts)
     {
       free_conflict_function (s->conflicting_iterations_in_a);
       free_conflict_function (s->conflicting_iterations_in_b);
+      free (s);
     }
   VEC_free (subscript_p, heap, subscripts);
 }
index 7e5f298..a97433b 100644 (file)
@@ -333,12 +333,12 @@ linear_transform_loops (void)
       lambda_loopnest before, after;
       lambda_trans_matrix trans;
       struct obstack lambda_obstack;
-      gcc_obstack_init (&lambda_obstack);
 
       depth = perfect_loop_nest_depth (loop_nest);
       if (depth == 0)
        continue;
 
+      gcc_obstack_init (&lambda_obstack);
       VEC_truncate (tree, oldivs, 0);
       VEC_truncate (tree, invariants, 0);
       VEC_truncate (tree, lambda_parameters, 0);
@@ -347,12 +347,12 @@ linear_transform_loops (void)
       dependence_relations = VEC_alloc (ddr_p, heap, 10 * 10);
       if (!compute_data_dependences_for_loop (loop_nest, true, &datarefs,
                                              &dependence_relations))
-       continue;
+       goto free_and_continue;
       
       lambda_collect_parameters (datarefs, &lambda_parameters);
       if (!lambda_compute_access_matrices (datarefs, lambda_parameters,
                                           loop_nest->num))
-       continue;
+       goto free_and_continue;
 
       if (dump_file && (dump_flags & TDF_DETAILS))
        dump_ddrs (dump_file, dependence_relations);
index 85cfbd6..b6ccfd7 100644 (file)
@@ -877,7 +877,12 @@ filter_suitable_components (struct loop *loop, struct component *comps)
        comp = &act->next;
       else
        {
+         dref ref;
+         unsigned i;
+
          *comp = act->next;
+         for (i = 0; VEC_iterate (dref, act->refs, i, ref); i++)
+           free (ref);
          release_component (act);
        }
     }
@@ -920,7 +925,10 @@ add_ref_to_chain (chain_p chain, dref ref)
   gcc_assert (double_int_scmp (root->offset, ref->offset) <= 0);
   dist = double_int_add (ref->offset, double_int_neg (root->offset));
   if (double_int_ucmp (uhwi_to_double_int (MAX_DISTANCE), dist) <= 0)
-    return;
+    {
+      free (ref);
+      return;
+    }
   gcc_assert (double_int_fits_in_uhwi_p (dist));
 
   VEC_safe_push (dref, heap, chain->refs, ref);