title: Do branch predictors handle indirect function calls, like virtual function calls?
body: <p>I was wondering about this. Branch predictors I think generally can handle binary indirect branches -- where there are two immediately visible possible paths the branch could take. However, I was thinking, are branch predictors able to predict indirect function calls, like a virtual function call in C++? Say, if a certain indirect function call at a certain place in the program calls one function 99% or even 100% of the time, does that get recorded and optimized by the branch predictor? I'm asking about architectures in general, but mostly interested in x86 and x86-64.</p>