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.
            Asked
            
        
        
            Active
            
        
            Viewed 756 times
        
    0
            
            
        - 
                    Look up the difference between _branch predictor_ and _branch target predictor_. – Mike Vine Nov 08 '20 at 21:34
- 
                    Perhaps https://stackoverflow.com/questions/7241922/how-has-cpu-architecture-evolution-affected-virtual-function-call-performance is helpful. – Morty Nov 08 '20 at 21:34
 
    