From: Jakub Jelinek <jakub@redhat.com>
To: Tobias Burnus <tobias@codesourcery.com>
Cc: Jan Hubicka <jh@suse.cz>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch] OpenMP: Handle cpp_implicit_alias in declare-target discovery (PR96390)
Date: Wed, 23 Sep 2020 16:06:42 +0200 [thread overview]
Message-ID: <20200923140642.GH2176@tucnak> (raw)
In-Reply-To: <54423ac9-a651-246f-3570-feb976f4b67e@codesourcery.com>
On Wed, Sep 23, 2020 at 03:52:12PM +0200, Tobias Burnus wrote:
> + if (TREE_CODE (*tp) == FUNCTION_DECL)
> {
> + tree decl = *tp;
> tree id = get_identifier ("omp declare target");
> - if (!DECL_EXTERNAL (*tp) && DECL_SAVED_TREE (*tp))
> - ((vec<tree> *) data)->safe_push (*tp);
> - DECL_ATTRIBUTES (*tp) = tree_cons (id, NULL_TREE, DECL_ATTRIBUTES (*tp));
> symtab_node *node = symtab_node::get (*tp);
> if (node != NULL)
> {
> + while (node->alias_target)
> + {
> + if (node->cpp_implicit_alias)
> + node = node->get_alias_target ();
> + 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);
> + }
> + if (node->cpp_implicit_alias)
> + node = node->get_alias_target ();
Almost, the problem is that node with node->cpp_implicit_alias isn't marked
then. And, the
> + if (node->cpp_implicit_alias)
> + node = node->get_alias_target ();
in the while loop looks problematic, not sure if it is ever possible
to have both alias_target and cpp_implicit_alias set, but if it would be,
there is no guarantee that node->get_alias_target ()->alias_target must be
non-NULL.
What I really meant was:
> + while (node->alias_target)
> + {
> + 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);
> + }
> + cgraph_node *new_node = node->get_ultimate_target ();
> + if (new_node != node)
> + {
> + while (node != new_node)
> + {
> + 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));
> + }
> + gcc_assert (node->alias && node->analyzed);
> + node = node->get_alias_target ();
> + }
> + }
Jakub
next prev parent reply other threads:[~2020-09-23 14:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-03 15:37 Tobias Burnus
2020-08-17 7:17 ` *PING* – " Tobias Burnus
2020-08-25 16:58 ` *PING**2 " Tobias Burnus
2020-08-31 15:53 ` Jakub Jelinek
2020-09-14 13:25 ` Tobias Burnus
2020-09-16 10:36 ` Jakub Jelinek
2020-09-16 23:15 ` Tobias Burnus
2020-09-22 7:11 ` Tobias Burnus
2020-09-22 7:36 ` Jakub Jelinek
2020-09-22 14:11 ` Tobias Burnus
2020-09-22 14:24 ` Jakub Jelinek
2020-09-22 15:39 ` Tobias Burnus
2020-09-23 13:52 ` Tobias Burnus
2020-09-23 14:06 ` Jakub Jelinek [this message]
2020-09-23 15:45 ` Tobias Burnus
2020-09-25 11:23 ` Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200923140642.GH2176@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jh@suse.cz \
--cc=tobias@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).