Patchwork Fix PR54629

login
register
mail settings
Submitter Richard Guenther
Date Sept. 21, 2012, 11:04 a.m.
Message ID <alpine.LNX.2.00.1209211303520.4063@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/185692/
State New
Headers show

Comments

Richard Guenther - Sept. 21, 2012, 11:04 a.m.
This patch from Jakub should fix issues with my previous patch.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2012-09-20  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/54629
	* tree-loop-distribution.c (classify_partition): Free loop nest only
	after freeing ddr.  Free ddr and loop nest also if successful.

Patch

--- gcc/tree-loop-distribution.c.jj	2012-09-20 09:22:02.000000000 +0200
+++ gcc/tree-loop-distribution.c	2012-09-20 09:35:05.953016313 +0200
@@ -1019,10 +1019,10 @@  classify_partition (loop_p loop, struct
       ddr = initialize_data_dependence_relation (single_load, single_store,
 						 loops);
       compute_affine_dependence (ddr, loop);
-      VEC_free (loop_p, heap, loops);
       if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
 	{
 	  free_dependence_relation (ddr);
+	  VEC_free (loop_p, heap, loops);
 	  return;
 	}
       if (DDR_ARE_DEPENDENT (ddr) != chrec_known)
@@ -1030,6 +1030,7 @@  classify_partition (loop_p loop, struct
 	  if (DDR_NUM_DIST_VECTS (ddr) == 0)
 	    {
 	      free_dependence_relation (ddr);
+	      VEC_free (loop_p, heap, loops);
 	      return;
 	    }
 	  lambda_vector dist_v;
@@ -1040,10 +1041,13 @@  classify_partition (loop_p loop, struct
 	      if (dist > 0 && !DDR_REVERSED_P (ddr))
 		{
 		  free_dependence_relation (ddr);
+		  VEC_free (loop_p, heap, loops);
 		  return;
 		}
 	    }
 	}
+      free_dependence_relation (ddr);
+      VEC_free (loop_p, heap, loops);
       partition->kind = PKIND_MEMCPY;
       partition->main_dr = single_store;
       partition->secondary_dr = single_load;