[PR hsa/87863] Set assembler name of group and global variables early

Martin Jambor mjambor@suse.cz
Fri Feb 1 10:27:00 GMT 2019


Hi,

to make a variable private to a HSA group (to which omp-gridification
maps OpenMP teams), they are made static but marked with special
attributes.  This does not play nicely with setting DECL_ASSEMBLER_NAME
after the fact, at least since r265714.  Setting it before does not work
with C FE but since what we actually want is a private name, I simply
decided to use create_tmp_var_name.

I have tested the patch on an HSA-capable APU and also bootstrapped and
tested it with hsa offloading enabled.  Since this code path in omp
lowering is specific to HSA, I will commit it later today as the HSA
maintainer.

Thanks and my apologies that it took me so lo long to address,

Martin


2019-01-30  Martin Jambor  <mjambor@suse.cz>

	PR hsa/87863
	* omp-grid.c (grid_mark_variable_segment): Set assembler name of group
	segment and global segment variables before making them static.
---
 gcc/omp-grid.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/omp-grid.c b/gcc/omp-grid.c
index 79e9405ce3f..1fdd8fc2efb 100644
--- a/gcc/omp-grid.c
+++ b/gcc/omp-grid.c
@@ -934,6 +934,8 @@ grid_mark_variable_segment (tree var, enum grid_var_segment segment)
   if (!TREE_STATIC (var))
     {
       TREE_STATIC (var) = 1;
+      const char *prefix = IDENTIFIER_POINTER (DECL_NAME (var));
+      SET_DECL_ASSEMBLER_NAME (var, create_tmp_var_name (prefix));
       varpool_node::finalize_decl (var);
     }
 
-- 
2.20.1



More information about the Gcc-patches mailing list