public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Make sure free_gimple_bb is called on all graphite created bbs (PR tree-optimization/46966)
@ 2010-12-16 22:45 Jakub Jelinek
  2010-12-16 23:01 ` Sebastian Pop
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2010-12-16 22:45 UTC (permalink / raw)
  To: Sebastian Pop; +Cc: gcc-patches

Hi!

graphite-sese-to-poly.c wasn't calling free_gimple_bb on some bbs it removed
from SCOP_BBS vector, which means both small memory leak and, more
importantly, leaving bb->aux as non-NULL.  Later passes assert that
bb->aux is NULL.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2010-12-16  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/46966
	* graphite-sese-to-poly.c (build_scop_drs): Call free_gimple_bb for
	for bbs that are removed from SCOP_BBS vector.

	* gcc.dg/graphite/pr46966.c: New test.

--- gcc/graphite-sese-to-poly.c.jj	2010-12-02 11:51:32.000000000 +0100
+++ gcc/graphite-sese-to-poly.c	2010-12-16 14:42:49.000000000 +0100
@@ -1971,6 +1971,7 @@ build_scop_drs (scop_p scop)
   for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
     if (VEC_empty (data_reference_p, GBB_DATA_REFS (PBB_BLACK_BOX (pbb))))
       {
+	free_gimple_bb (PBB_BLACK_BOX (pbb));
 	VEC_ordered_remove (poly_bb_p, SCOP_BBS (scop), i);
 	i--;
       }
--- gcc/testsuite/gcc.dg/graphite/pr46966.c.jj	2010-12-16 14:49:37.000000000 +0100
+++ gcc/testsuite/gcc.dg/graphite/pr46966.c	2010-12-16 14:50:48.000000000 +0100
@@ -0,0 +1,13 @@
+/* PR tree-optimization/46966 */
+/* { dg-do compile } */
+/* { dg-options "-O -floop-interchange -ffast-math -fno-tree-copy-prop -fno-tree-loop-im" } */
+
+int a[1000][1000];
+
+void foo ()
+{
+  int i, j;
+  for (i = 0; i < 1000; i++)
+    for (j = 0; j < 1000; j++)
+      a[i][j] = 0;
+}

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Make sure free_gimple_bb is called on all graphite created bbs (PR tree-optimization/46966)
  2010-12-16 22:45 [PATCH] Make sure free_gimple_bb is called on all graphite created bbs (PR tree-optimization/46966) Jakub Jelinek
@ 2010-12-16 23:01 ` Sebastian Pop
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Pop @ 2010-12-16 23:01 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Thu, Dec 16, 2010 at 15:57, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> graphite-sese-to-poly.c wasn't calling free_gimple_bb on some bbs it removed
> from SCOP_BBS vector, which means both small memory leak and, more
> importantly, leaving bb->aux as non-NULL.  Later passes assert that
> bb->aux is NULL.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?

Yes, please install.  Thanks for fixing this.

Sebastian

>
> 2010-12-16  Jakub Jelinek  <jakub@redhat.com>
>
>        PR tree-optimization/46966
>        * graphite-sese-to-poly.c (build_scop_drs): Call free_gimple_bb for
>        for bbs that are removed from SCOP_BBS vector.
>
>        * gcc.dg/graphite/pr46966.c: New test.
>
> --- gcc/graphite-sese-to-poly.c.jj      2010-12-02 11:51:32.000000000 +0100
> +++ gcc/graphite-sese-to-poly.c 2010-12-16 14:42:49.000000000 +0100
> @@ -1971,6 +1971,7 @@ build_scop_drs (scop_p scop)
>   for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
>     if (VEC_empty (data_reference_p, GBB_DATA_REFS (PBB_BLACK_BOX (pbb))))
>       {
> +       free_gimple_bb (PBB_BLACK_BOX (pbb));
>        VEC_ordered_remove (poly_bb_p, SCOP_BBS (scop), i);
>        i--;
>       }
> --- gcc/testsuite/gcc.dg/graphite/pr46966.c.jj  2010-12-16 14:49:37.000000000 +0100
> +++ gcc/testsuite/gcc.dg/graphite/pr46966.c     2010-12-16 14:50:48.000000000 +0100
> @@ -0,0 +1,13 @@
> +/* PR tree-optimization/46966 */
> +/* { dg-do compile } */
> +/* { dg-options "-O -floop-interchange -ffast-math -fno-tree-copy-prop -fno-tree-loop-im" } */
> +
> +int a[1000][1000];
> +
> +void foo ()
> +{
> +  int i, j;
> +  for (i = 0; i < 1000; i++)
> +    for (j = 0; j < 1000; j++)
> +      a[i][j] = 0;
> +}
>
>        Jakub
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-16 22:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-16 22:45 [PATCH] Make sure free_gimple_bb is called on all graphite created bbs (PR tree-optimization/46966) Jakub Jelinek
2010-12-16 23:01 ` Sebastian Pop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).