Patchwork [10/28] Fix pbb_remove_duplicate_pdrs.

login
register
mail settings
Submitter Sebastian Pop
Date Jan. 21, 2011, 7:27 p.m.
Message ID <1295638067-13460-11-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/79905/
State New
Headers show

Comments

Sebastian Pop - Jan. 21, 2011, 7:27 p.m.
From: spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>

2011-01-15  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-poly.c (pbb_remove_duplicate_pdrs): Make it work.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@168836 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog          |    4 ++++
 gcc/ChangeLog.graphite |    4 ++++
 gcc/graphite-poly.c    |   13 +++++++------
 3 files changed, 15 insertions(+), 6 deletions(-)

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f10317b..6898f95 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@ 
 2011-01-21  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-poly.c (pbb_remove_duplicate_pdrs): Make it work.
+
+2011-01-21  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-interchange.c (lst_interchange_profitable_p): Takes a loop
 	nest and two loop depths as parameters.
 	(lst_try_interchange_loops): Call lst_interchange_profitable_p after
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 2363df6..d961c0c 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,9 @@ 
 2011-01-15  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-poly.c (pbb_remove_duplicate_pdrs): Make it work.
+
+2011-01-15  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-interchange.c (lst_interchange_profitable_p): Takes a loop
 	nest and two loop depths as parameters.
 	(lst_try_interchange_loops): Call lst_interchange_profitable_p after
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index f88788b..bfdbc9f 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -813,15 +813,16 @@  pbb_remove_duplicate_pdrs (poly_bb_p pbb)
 {
   int i, j;
   poly_dr_p pdr1, pdr2;
-  unsigned n = VEC_length (poly_dr_p, PBB_DRS (pbb));
-  VEC (poly_dr_p, heap) *collapsed = VEC_alloc (poly_dr_p, heap, n);
 
   FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), i, pdr1)
-    FOR_EACH_VEC_ELT (poly_dr_p, collapsed, j, pdr2)
-      if (!can_collapse_pdrs (pdr1, pdr2))
-	VEC_quick_push (poly_dr_p, collapsed, pdr1);
+    for (j = i + 1; VEC_iterate (poly_dr_p, PBB_DRS (pbb), j, pdr2); j++)
+      if (can_collapse_pdrs (pdr1, pdr2))
+	{
+	  PDR_NB_REFS (pdr1) += PDR_NB_REFS (pdr2);
+	  free_poly_dr (pdr2);
+	  VEC_ordered_remove (poly_dr_p, PBB_DRS (pbb), j);
+	}
 
-  VEC_free (poly_dr_p, heap, collapsed);
   PBB_PDR_DUPLICATES_REMOVED (pbb) = true;
 }