[Patch] OpenMP: Handle cpp_implicit_alias in declare-target discovery (PR96390)

Jakub Jelinek jakub@redhat.com
Tue Sep 22 14:24:33 GMT 2020


On Tue, Sep 22, 2020 at 04:11:19PM +0200, Tobias Burnus wrote:
> +	  while (node->alias_target)
> +	    {
> +	      node = node->ultimate_alias_target ();

At least in theory, ultimate_alias_target can look through multiple aliases.
While it might not do that most of the time because this is executed quite
early, I think we have no guarantees it will never do it.
So I'd prefer what you had in the earlier patch, i.e. do the
ultimate_alias_target call + loop to find the ultimate node, and then
in another loop go from the original node (inclusive) up to the ultimate one
(exclusive) and do what you do in this loop now.
Does that make sense?

> +	      if (!omp_declare_target_fn_p (node->decl)
> +		  && !lookup_attribute ("omp declare target host",
> +					DECL_ATTRIBUTES (node->decl)))
> +		{
> +		  node->offloadable = 1;
> +		  DECL_ATTRIBUTES (node->decl)
> +		    = tree_cons (id, NULL_TREE, DECL_ATTRIBUTES (node->decl));
> +		}
> +	      node = symtab_node::get (node->alias_target);

	Jakub



More information about the Gcc-patches mailing list