From: Jan Hubicka <hubicka@ucw.cz>
To: "Martin Liška" <mliska@suse.cz>
Cc: Jason Merrill <jason@redhat.com>,
gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: RFC (branch prediction): PATCH to implement P0479R5, [[likely]] and [[unlikely]].
Date: Thu, 15 Nov 2018 12:14:00 -0000 [thread overview]
Message-ID: <20181115121433.7aq3fichywot6og5@kam.mff.cuni.cz> (raw)
In-Reply-To: <17dbdeaa-2cea-31b0-d38a-f6b1464f6a1a@suse.cz>
> > A warning seems appropriate. You think the front end is the right
> > place for that?
>
> Probably yes. Note that middle-end can optimize about dead branches and so that
> theoretically one can end up with a branching where e.g. both branches are [[likely]].
> I wouldn't bother users with these.
Note that what really happens in this case is that if conditional is
constant propagated and it has predict_expr, the predict_expr stays and
will get assigned to the random control dependence edge which controls
execution of the original statement. This is not very intuitive
behaviour. Does C++ say what should happen in this case?
One option would be to deal with this gratefully at high level gimple
and turn predict_exprs into edge probabilities eariler than we do normal
branch prediction (which is intended to be later so profile does not end
up unnecesarily inconsistent)
Honza
>
> Martin
>
> >
> > Jason
> >
>
next prev parent reply other threads:[~2018-11-15 12:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-13 4:43 Jason Merrill
2018-11-13 14:20 ` Martin Liška
2018-11-13 19:43 ` Jason Merrill
2018-11-15 10:51 ` Martin Liška
2018-11-15 12:14 ` Jan Hubicka [this message]
2018-11-16 18:36 ` Jason Merrill
2018-11-16 21:23 ` Jan Hubicka
2018-11-30 10:26 ` Martin Liška
2019-02-18 12:44 ` Martin Liška
2019-02-18 19:34 ` Jason Merrill
2019-02-19 9:53 ` Martin Liška
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=20181115121433.7aq3fichywot6og5@kam.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=mliska@suse.cz \
/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).