summaryrefslogtreecommitdiff
path: root/gcc/graphite-poly.c
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2011-01-25 06:45:16 +0000
committerSebastian Pop <spop@gcc.gnu.org>2011-01-25 06:45:16 +0000
commit271fb6fae1c01083fe3abb084134b9549623f204 (patch)
treea6ac26ee532a93754ef5a0d99b255b063cca8a4e /gcc/graphite-poly.c
parent92d236802c2627840591e08c522c3abe6e63ff70 (diff)
downloadgcc-271fb6fae1c01083fe3abb084134b9549623f204.tar.gz
Fix pbb_remove_duplicate_pdrs.
2011-01-25 Sebastian Pop <sebastian.pop@amd.com> * graphite-poly.c (pbb_remove_duplicate_pdrs): Make it work. From-SVN: r169202
Diffstat (limited to 'gcc/graphite-poly.c')
-rw-r--r--gcc/graphite-poly.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index f88788b8113..bfdbc9f3af4 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;
}