public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix build of --enable-gather-detailed-mem-stats (PR bootstrap/81864).
@ 2017-08-17 14:18 Martin Liška
  2017-08-17 14:56 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2017-08-17 14:18 UTC (permalink / raw)
  To: gcc-patches; +Cc: hjl.tools, andrewm.roberts

[-- Attachment #1: Type: text/plain, Size: 650 bytes --]

Hello.

As described in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81864#c5 we should not
introduce a new static hash_table variable in order to be sure mem_alloc_descriptors
are initialized earlier.


Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin


gcc/ChangeLog:

2017-08-17  Martin Liska  <mliska@suse.cz>

	PR bootstrap/81864
	* tree-loop-distribution.c (ddrs_table): Change type to pointer
	type.
	(get_data_dependence): Use it as pointer type.
	(distribute_loop): Likewise.
---
  gcc/tree-loop-distribution.c | 15 +++++++++------
  1 file changed, 9 insertions(+), 6 deletions(-)



[-- Attachment #2: 0001-Fix-build-of-enable-gather-detailed-mem-stats-PR-boo.patch --]
[-- Type: text/x-patch, Size: 2429 bytes --]

diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index b1b293419b0..26b8b9a3751 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -157,8 +157,7 @@ static vec<data_reference_p> datarefs_vec;
 #define DR_INDEX(dr)      ((uintptr_t) (dr)->aux)
 
 /* Hash table for data dependence relation in the loop to be distributed.  */
-static hash_table<ddr_hasher> ddrs_table (389);
-
+static hash_table<ddr_hasher> *ddrs_table;
 
 /* A Reduced Dependence Graph (RDG) vertex representing a statement.  */
 struct rdg_vertex
@@ -1183,7 +1182,7 @@ get_data_dependence (struct graph *rdg, data_reference_p a, data_reference_p b)
 	      <= rdg_vertex_for_stmt (rdg, DR_STMT (b)));
   ent.a = a;
   ent.b = b;
-  slot = ddrs_table.find_slot (&ent, INSERT);
+  slot = ddrs_table->find_slot (&ent, INSERT);
   if (*slot == NULL)
     {
       ddr = initialize_data_dependence_relation (a, b, loop_nest);
@@ -2366,6 +2365,7 @@ static int
 distribute_loop (struct loop *loop, vec<gimple *> stmts,
 		 control_dependences *cd, int *nb_calls, bool *destroy_p)
 {
+  ddrs_table = new hash_table<ddr_hasher> (389);
   struct graph *rdg;
   partition *partition;
   bool any_builtin;
@@ -2377,6 +2377,7 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
   if (!find_loop_nest (loop, &loop_nest))
     {
       loop_nest.release ();
+      delete ddrs_table;
       return 0;
     }
 
@@ -2391,6 +2392,7 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
 
       loop_nest.release ();
       free_data_refs (datarefs_vec);
+      delete ddrs_table;
       return 0;
     }
 
@@ -2404,6 +2406,7 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
       free_rdg (rdg);
       loop_nest.release ();
       free_data_refs (datarefs_vec);
+      delete ddrs_table;
       return 0;
     }
 
@@ -2542,13 +2545,13 @@ distribute_loop (struct loop *loop, vec<gimple *> stmts,
  ldist_done:
   loop_nest.release ();
   free_data_refs (datarefs_vec);
-  for (hash_table<ddr_hasher>::iterator iter = ddrs_table.begin ();
-       iter != ddrs_table.end (); ++iter)
+  for (hash_table<ddr_hasher>::iterator iter = ddrs_table->begin ();
+       iter != ddrs_table->end (); ++iter)
     {
       free_dependence_relation (*iter);
       *iter = NULL;
     }
-  ddrs_table.empty ();
+  delete ddrs_table;
 
   FOR_EACH_VEC_ELT (partitions, i, partition)
     partition_free (partition);


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

* Re: [PATCH] Fix build of --enable-gather-detailed-mem-stats (PR bootstrap/81864).
  2017-08-17 14:18 [PATCH] Fix build of --enable-gather-detailed-mem-stats (PR bootstrap/81864) Martin Liška
@ 2017-08-17 14:56 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2017-08-17 14:56 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches, H. J. Lu, andrewm.roberts

On Thu, Aug 17, 2017 at 3:43 PM, Martin Liška <mliska@suse.cz> wrote:
> Hello.
>
> As described in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81864#c5 we
> should not
> introduce a new static hash_table variable in order to be sure
> mem_alloc_descriptors
> are initialized earlier.
>
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?

Ok.

Richard.

> Martin
>
>
> gcc/ChangeLog:
>
> 2017-08-17  Martin Liska  <mliska@suse.cz>
>
>         PR bootstrap/81864
>         * tree-loop-distribution.c (ddrs_table): Change type to pointer
>         type.
>         (get_data_dependence): Use it as pointer type.
>         (distribute_loop): Likewise.
> ---
>  gcc/tree-loop-distribution.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
>
>

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

end of thread, other threads:[~2017-08-17 14:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-17 14:18 [PATCH] Fix build of --enable-gather-detailed-mem-stats (PR bootstrap/81864) Martin Liška
2017-08-17 14:56 ` Richard Biener

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).