[LLVMdev] Hi Cache Miss and Branch Misprediction

Mike Stump mrs at apple.com
Mon Sep 29 17:30:53 PDT 2008


On Sep 28, 2008, at 6:43 PM, Ketan Pundlik Umare wrote:
> I am an absolute newbie to the compiler community. I am  
> experimenting a little bit with llvm.
> I have a few small questions, i would be really great if someone  
> could help me.
>
> 1. Can i find out (is there something already built), if the  
> previous instruction / or some instruction was a cache miss.  
> Basically i want to detect cache misses and instructions that are  
> causing this

Well, you could time it, though, doing that alters the code of  
course.  Small time, in cache, bigger time, in farther away cache,  
bigger time, in dram, bigger time, page fault.  No one in the real  
world does this.  Instead the use tools like Shark or vtune.  You can  
say, show me all the instructions that missed cache and how often they  
missed.

> 2. Can i find if there was a branch misprediction?

Likewise.  Though, I'm trying to recall if mispredictions where one of  
the things one could watch for on x86.  google around for performance  
counters on x86.

> 3. Can i find if a branch was taken or not taken?

:-)  gcov will tell you this today.



More information about the llvm-dev mailing list