[LLVMdev] Hi Cache Miss and Branch Misprediction

Ketan Pundlik Umare kumare3 at cc.gatech.edu
Mon Sep 29 09:29:41 PDT 2008


Thanx a lot Nick!!!
I will try to look at it and let you know.

Thank you
Ketan
----- Original Message -----
From: "Nick Lewycky" <nicholas at mxc.ca>
To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>
Sent: Monday, September 29, 2008 3:21:31 AM GMT -05:00 US/Canada Eastern
Subject: Re: [LLVMdev] Hi Cache Miss and Branch Misprediction

Ketan Pundlik Umare wrote:
> Hi Guys,
> 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.

It sounds like what you want is valgrind --tool=cachegrind (or 
--tool=callgrind). See http://valgrind.org/

> 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
> 
> 2. Can i find if there was a branch misprediction?
> 
> 3. Can i find if a branch was taken or not taken?
> 
> It would be really great if someone could answer this for me.

I suppose you could instrument the existing LLVM JIT to collect this 
sort of information.

Realize that much of LLVM works in the LLVM IR language, and we just 
'lower' to assembly. LLVM 'passes' which modify code work by editing the 
IR, not the assembly, so things like 'branch prediction' and whatnot 
don't exist at that level. If you want to do it with LLVM, you'll likely 
need to build most of the infrastructure yourself.

If you're interested in what we do have, see llvm/tools/llvm-prof.cpp, 
llvm/runtime/libprofile and llvm/utils/profile.pl . I have no idea what 
state this stuff is in, quite possibly bitrotted.

Nick Lewycky
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



More information about the llvm-dev mailing list