This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, OpenACC] Enable GOMP_MAP_FIRSTPRIVATE_INT for OpenACC


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]