public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7348] Further simplify 'gcc/omp-oacc-neuter-broadcast.cc:record_field_map_t'
@ 2022-02-22 16:46 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-02-22 16:46 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0fe9176f410accc767e0abab010aec843b2e7ea6

commit r12-7348-g0fe9176f410accc767e0abab010aec843b2e7ea6
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Fri Aug 13 21:17:55 2021 +0200

    Further simplify 'gcc/omp-oacc-neuter-broadcast.cc:record_field_map_t'
    
    Now that I've resolved GCC 'hash_map' issues (a while ago already), we may
    further simplify this after commit 049eda8274b7394523238b17ab12c3e2889f253e
    "Avoid 'GTY' use for 'gcc/omp-oacc-neuter-broadcast.cc:field_map'": as
    'hash_map' Value, directly store 'field_map_t' objects, not pointers to
    manually allocated 'field_map_t' objects.
    
            gcc/
            * omp-oacc-neuter-broadcast.cc (record_field_map_t): Further
            simplify.  Adjust all users.

Diff:
---
 gcc/omp-oacc-neuter-broadcast.cc | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/gcc/omp-oacc-neuter-broadcast.cc b/gcc/omp-oacc-neuter-broadcast.cc
index 7fb691d7155..314161e38f5 100644
--- a/gcc/omp-oacc-neuter-broadcast.cc
+++ b/gcc/omp-oacc-neuter-broadcast.cc
@@ -538,7 +538,7 @@ typedef hash_map<tree, tree> field_map_t;
    to propagate, to the field in the record type that should be used for
    transmission and reception.  */
 
-typedef hash_map<tree, field_map_t *> record_field_map_t;
+typedef hash_map<tree, field_map_t> record_field_map_t;
 
 static void
 install_var_field (tree var, tree record_type, field_map_t *fields)
@@ -1168,8 +1168,7 @@ worker_single_copy (basic_block from, basic_block to,
 	gcc_assert (TREE_CODE (var) == VAR_DECL);
 
       /* If we had no record type, we will have no fields map.  */
-      field_map_t **fields_p = record_field_map->get (record_type);
-      field_map_t *fields = fields_p ? *fields_p : NULL;
+      field_map_t *fields = record_field_map->get (record_type);
 
       if (worker_partitioned_uses->contains (var)
 	  && fields
@@ -1684,10 +1683,9 @@ oacc_do_neutering (unsigned HOST_WIDE_INT bounds_lo,
 
 	  field_vec.qsort (sort_by_size_then_ssa_version_or_uid);
 
-	  field_map_t *fields = new field_map_t;
-
 	  bool existed;
-	  existed = record_field_map.put (record_type, fields);
+	  field_map_t *fields
+	    = &record_field_map.get_or_insert (record_type, &existed);
 	  gcc_checking_assert (!existed);
 
 	  /* Insert var fields in reverse order, so the last inserted element
@@ -1818,8 +1816,6 @@ oacc_do_neutering (unsigned HOST_WIDE_INT bounds_lo,
 			&partitioned_var_uses, &record_field_map,
 			&blk_offset_map, writes_gang_private);
 
-  for (auto it : record_field_map)
-    delete it.second;
   record_field_map.empty ();
 
   /* These are supposed to have been 'delete'd by 'neuter_worker_single'.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-22 16:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 16:46 [gcc r12-7348] Further simplify 'gcc/omp-oacc-neuter-broadcast.cc:record_field_map_t' Thomas Schwinge

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