This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gc-improv] Convert sese.c to use obstack


On Mon, Nov 2, 2009 at 13:29, Laurynas Biveinis
<laurynas.biveinis@gmail.com> wrote:
>> Couldn't we avoid the obstacks by replacing all these alloc with XNEW?
>
> Of course, as long as there is a convienent place for corresponding XFREE calls.

Please revert your changes and apply the attached patch.
I've committed the attached patch to the graphite branch as well.

Thanks,
Sebastian
From 910258d5510f50ebe3cf9b0d4a620bbf037f8dd0 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Tue, 3 Nov 2009 00:18:24 -0600
Subject: [PATCH] Do not use GGC.

2009-11-03  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-clast-to-gimple.c (gloog): Free if_region,
	if_region->true_region, and if_region->region.
	* sese.c (if_region_set_false_region): Free if_region->false_region.
	(create_if_region_on_edge): Do not use GGC_NEW.
	(move_sese_in_condition): Remove useless initialization.
---
 gcc/ChangeLog.graphite         |    8 ++++++++
 gcc/graphite-clast-to-gimple.c |    4 ++++
 gcc/sese.c                     |   13 ++++++++-----
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index e57b52a..c4abb5d 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,13 @@
 2009-11-03  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-clast-to-gimple.c (gloog): Free if_region,
+	if_region->true_region, and if_region->region.
+	* sese.c (if_region_set_false_region): Free if_region->false_region.
+	(create_if_region_on_edge): Do not use GGC_NEW.
+	(move_sese_in_condition): Remove useless initialization.
+
+2009-11-03  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-interchange.c (lst_perfect_nestify): Pass 3 parameters
 	for the loops created by the loop distribution.  Do not modify the
 	input LSTs.
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index ecfdd69..bf11458 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -1201,6 +1201,10 @@ gloog (scop_p scop, htab_t bb_pbb_mapping)
   recompute_all_dominators ();
   graphite_verify ();
 
+  free (if_region->true_region);
+  free (if_region->region);
+  free (if_region);
+
   htab_delete (rename_map);
   htab_delete (newivs_index);
   VEC_free (tree, heap, newivs);
diff --git a/gcc/sese.c b/gcc/sese.c
index 8c74cec..f30b34b 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -1297,6 +1297,9 @@ if_region_set_false_region (ifsese if_region, sese region)
   recompute_all_dominators ();
 
   SESE_EXIT (region) = false_edge;
+
+  if (if_region->false_region)
+    free (if_region->false_region);
   if_region->false_region = region;
 
   if (slot)
@@ -1322,10 +1325,10 @@ create_if_region_on_edge (edge entry, tree condition)
 {
   edge e;
   edge_iterator ei;
-  sese sese_region = GGC_NEW (struct sese_s);
-  sese true_region = GGC_NEW (struct sese_s);
-  sese false_region = GGC_NEW (struct sese_s);
-  ifsese if_region = GGC_NEW (struct ifsese_s);
+  sese sese_region = XNEW (struct sese_s);
+  sese true_region = XNEW (struct sese_s);
+  sese false_region = XNEW (struct sese_s);
+  ifsese if_region = XNEW (struct ifsese_s);
   edge exit = create_empty_if_region_on_edge (entry, condition);
 
   if_region->region = sese_region;
@@ -1362,7 +1365,7 @@ ifsese
 move_sese_in_condition (sese region)
 {
   basic_block pred_block = split_edge (SESE_ENTRY (region));
-  ifsese if_region = NULL;
+  ifsese if_region;
 
   SESE_ENTRY (region) = single_succ_edge (pred_block);
   if_region = create_if_region_on_edge (single_pred_edge (pred_block), integer_one_node);
-- 
1.6.0.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]