Get rid of 'gcc/omp-oacc-neuter-broadcast.cc:oacc_build_component_ref'
authorThomas Schwinge <thomas@codesourcery.com>
Fri, 30 Jul 2021 14:15:25 +0000 (16:15 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Tue, 22 Feb 2022 16:53:10 +0000 (17:53 +0100)
Clean-up for commit e2a58ed6dc5293602d0d168475109caa81ad0f0d
"openacc: Middle-end worker-partitioning support":
as of commit 2a3f9f6532bb21d8ab6f16fbe9ee603f6b1405f2
"openacc: Shared memory layout optimisation", we're no longer
running into the vectorizer ICEs for '!ADDR_SPACE_GENERIC_P'.

gcc/
* omp-low.cc (omp_build_component_ref): Move function...
* omp-general.cc (omp_build_component_ref): ... here.  Remove
'static'.
* omp-general.h (omp_build_component_ref): Declare function.
* omp-oacc-neuter-broadcast.cc (oacc_build_component_ref): Remove
function.
(build_receiver_ref, build_sender_ref): Call
'omp_build_component_ref' instead.

gcc/omp-general.cc
gcc/omp-general.h
gcc/omp-low.cc
gcc/omp-oacc-neuter-broadcast.cc

index 19f40dc..a406c57 100644 (file)
@@ -2980,4 +2980,18 @@ oacc_get_ifn_dim_arg (const gimple *stmt)
   return (int) axis;
 }
 
+/* Build COMPONENT_REF and set TREE_THIS_VOLATILE and TREE_READONLY on it
+   as appropriate.  */
+
+tree
+omp_build_component_ref (tree obj, tree field)
+{
+  tree ret = build3 (COMPONENT_REF, TREE_TYPE (field), obj, field, NULL);
+  if (TREE_THIS_VOLATILE (field))
+    TREE_THIS_VOLATILE (ret) |= 1;
+  if (TREE_READONLY (field))
+    TREE_READONLY (ret) |= 1;
+  return ret;
+}
+
 #include "gt-omp-general.h"
index c0cf5f0..7a94831 100644 (file)
@@ -149,4 +149,6 @@ get_openacc_privatization_dump_flags ()
   return l_dump_flags;
 }
 
+extern tree omp_build_component_ref (tree obj, tree field);
+
 #endif /* GCC_OMP_GENERAL_H */
index 77176ef..2294456 100644 (file)
@@ -621,21 +621,6 @@ omp_copy_decl_1 (tree var, omp_context *ctx)
   return omp_copy_decl_2 (var, DECL_NAME (var), TREE_TYPE (var), ctx);
 }
 
-/* Build COMPONENT_REF and set TREE_THIS_VOLATILE and TREE_READONLY on it
-   as appropriate.  */
-/* See also 'gcc/omp-oacc-neuter-broadcast.cc:oacc_build_component_ref'.  */
-
-static tree
-omp_build_component_ref (tree obj, tree field)
-{
-  tree ret = build3 (COMPONENT_REF, TREE_TYPE (field), obj, field, NULL);
-  if (TREE_THIS_VOLATILE (field))
-    TREE_THIS_VOLATILE (ret) |= 1;
-  if (TREE_READONLY (field))
-    TREE_READONLY (ret) |= 1;
-  return ret;
-}
-
 /* Build tree nodes to access the field for VAR on the receiver side.  */
 
 static tree
index 314161e..81e3223 100644 (file)
@@ -937,35 +937,13 @@ worker_single_simple (basic_block from, basic_block to,
     }
 }
 
-/* Build COMPONENT_REF and set TREE_THIS_VOLATILE and TREE_READONLY on it
-   as appropriate.  */
-/* Adapted from 'gcc/omp-low.cc:omp_build_component_ref'.  */
-
-static tree
-oacc_build_component_ref (tree obj, tree field)
-{
-  tree field_type = TREE_TYPE (field);
-  tree obj_type = TREE_TYPE (obj);
-  if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (obj_type)))
-    field_type = build_qualified_type
-                       (field_type,
-                        KEEP_QUAL_ADDR_SPACE (TYPE_QUALS (obj_type)));
-
-  tree ret = build3 (COMPONENT_REF, field_type, obj, field, NULL);
-  if (TREE_THIS_VOLATILE (field))
-    TREE_THIS_VOLATILE (ret) |= 1;
-  if (TREE_READONLY (field))
-    TREE_READONLY (ret) |= 1;
-  return ret;
-}
-
 static tree
 build_receiver_ref (tree var, tree receiver_decl, field_map_t *fields)
 {
   tree x = build_simple_mem_ref (receiver_decl);
   tree field = *fields->get (var);
   TREE_THIS_NOTRAP (x) = 1;
-  x = oacc_build_component_ref (x, field);
+  x = omp_build_component_ref (x, field);
   return x;
 }
 
@@ -975,7 +953,7 @@ build_sender_ref (tree var, tree sender_decl, field_map_t *fields)
   if (POINTER_TYPE_P (TREE_TYPE (sender_decl)))
     sender_decl = build_simple_mem_ref (sender_decl);
   tree field = *fields->get (var);
-  return oacc_build_component_ref (sender_decl, field);
+  return omp_build_component_ref (sender_decl, field);
 }
 
 static int