Use an obstack for PTA equiv class hashes
diff mbox series

Message ID nycvar.YFH.7.76.1911210921120.5566@zhemvz.fhfr.qr
State New
Headers show
Series
  • Use an obstack for PTA equiv class hashes
Related show

Commit Message

Richard Biener Nov. 21, 2019, 8:22 a.m. UTC
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2019-11-21  Richard Biener  <rguenther@suse.de>

	* tree-ssa-structalias.c (equiv_class_hasher): Change to nofree.
	(equiv_class_obstack): New.
	(equiv_class_lookup_or_add): Allocate from equiv_class_obstack.
	(perform_var_substitution): Initialize equiv_class_obstack.
	(free_var_substitution_info): Free equiv_class_obstack.

Patch
diff mbox series

Index: gcc/tree-ssa-structalias.c
===================================================================
--- gcc/tree-ssa-structalias.c	(revision 278496)
+++ gcc/tree-ssa-structalias.c	(working copy)
@@ -1911,7 +1911,7 @@  typedef const struct equiv_class_label *
 
 /* Equiv_class_label hashtable helpers.  */
 
-struct equiv_class_hasher : free_ptr_hash <equiv_class_label>
+struct equiv_class_hasher : nofree_ptr_hash <equiv_class_label>
 {
   static inline hashval_t hash (const equiv_class_label *);
   static inline bool equal (const equiv_class_label *,
@@ -1944,6 +1944,8 @@  static hash_table<equiv_class_hasher> *p
    classes.  */
 static hash_table<equiv_class_hasher> *location_equiv_class_table;
 
+struct obstack equiv_class_obstack;
+
 /* Lookup a equivalence class in TABLE by the bitmap of LABELS with
    hash HAS it contains.  Sets *REF_LABELS to the bitmap LABELS
    is equivalent to.  */
@@ -1960,7 +1962,7 @@  equiv_class_lookup_or_add (hash_table<eq
   slot = table->find_slot (&ecl, INSERT);
   if (!*slot)
     {
-      *slot = XNEW (struct equiv_class_label);
+      *slot = XOBNEW (&equiv_class_obstack, struct equiv_class_label);
       (*slot)->labels = labels;
       (*slot)->hashcode = ecl.hashcode;
       (*slot)->equivalence_class = 0;
@@ -2334,6 +2336,7 @@  perform_var_substitution (constraint_gra
   scc_info *si = new scc_info (size);
 
   bitmap_obstack_initialize (&iteration_obstack);
+  gcc_obstack_init (&equiv_class_obstack);
   pointer_equiv_class_table = new hash_table<equiv_class_hasher> (511);
   location_equiv_class_table
     = new hash_table<equiv_class_hasher> (511);
@@ -2473,6 +2476,7 @@  free_var_substitution_info (class scc_in
   pointer_equiv_class_table = NULL;
   delete location_equiv_class_table;
   location_equiv_class_table = NULL;
+  obstack_free (&equiv_class_obstack, NULL);
   bitmap_obstack_release (&iteration_obstack);
 }