Eric Botcazou <ebotca...@adacore.com> writes: >> I'm not sure using flags_to_condition really buys anything then, >> since you have to think about each individual case to see whether >> it belongs in the switch or not. I also don't have any proof >> that the no-op cases are the common ones (since adding this >> fast path of course slows down the others). > > Really? Branch prediction is rather efficient these days.
Sure. But we're still adding another branch here to avoid the branches in flags_to_condition in some cases. There's no guarantee that this branch is going to be more predictable than the ones in flags_to_condition, or that the total number of mispredicts is going to be lower this way. (Not saying it won't be, just that we're making assumptions if we think it will.) I just think we should only add extra code like this if we have proof that it makes things better, or at least that the cases it handles are worth handling specially. But by the same token, the status quo wins if there's doubt about whether the original patch itself is worthwhile. Richard