> > 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 > > >