This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, OpenACC] Enable GOMP_MAP_FIRSTPRIVATE_INT for OpenACC
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Julian Brown <julian at codesourcery dot com>, Thomas Schwinge <thomas at codesourcery dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>, Cesar Philippidis <cesar at codesourcery dot com>, fortran at gcc dot gnu dot org
- Date: Tue, 18 Dec 2018 13:47:34 +0100
- Subject: Re: [PATCH, OpenACC] Enable GOMP_MAP_FIRSTPRIVATE_INT for OpenACC
- References: <20180920193804.2413efa1@squid.athome> <20181204142712.GY12380@tucnak> <20181206224041.0be7ec2f@squid.athome> <20181207140546.GK12380@tucnak> <20181213154425.47dec74d@squid.athome>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Dec 13, 2018 at 03:44:25PM +0000, Julian Brown wrote:
> +static tree
> +convert_to_firstprivate_int (tree var, gimple_seq *gs)
> +{
> + tree type = TREE_TYPE (var), new_type = NULL_TREE;
> + tree tmp = NULL_TREE;
> +
> + if (omp_is_reference (var))
> + type = TREE_TYPE (type);
> +
> + if (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type))
> + {
> + if (omp_is_reference (var))
> + {
> + tmp = create_tmp_var (type);
> + gimplify_assign (tmp, build_simple_mem_ref (var), gs);
> + var = tmp;
> + }
> +
> + return fold_convert (pointer_sized_int_node, var);
> + }
> +
> + gcc_assert (tree_to_uhwi (TYPE_SIZE (type)) <= POINTER_SIZE);
> +
> + new_type = lang_hooks.types.type_for_size (tree_to_uhwi (TYPE_SIZE (type)),
> + true);
> +
> + if (omp_is_reference (var))
> + {
> + tmp = create_tmp_var (type);
> + gimplify_assign (tmp, build_simple_mem_ref (var), gs);
> + var = tmp;
> + }
Why are you duplicating this if? Can't you just do it before the
if (INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type))
test once, even better in the same if as you do type = TREE_TYPE (type); ?
Otherwise ok from me, but please check with Thomas if he is ok with it too.
Jakub