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: RFC (branch prediction): PATCH to implement P0479R5, [[likely]] and [[unlikely]].


> On Thu, Nov 15, 2018 at 7:14 AM Jan Hubicka <hubicka@ucw.cz> wrote:
> >
> > > > 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?
> 
> No, it doesn't say much.
> 
> > 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)
> 
> Sounds reasonable.
> 
> This additional patch implements the suggested diagnostics.

Looks good to me. Next stage1 I will experiment with moving path
prediction up in the pass queue. It should be quite easy to do.

Honza


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