[LLVMdev] [GSoC 2014] Using LLVM as a code-generation backend for Valgrind

Denis Steckelmacher steckdenis at yahoo.fr
Tue Feb 25 06:08:42 PST 2014


On 02/25/2014 09:52 AM, David Chisnall wrote:
 > On 25 Feb 2014, at 07:50, Reid Kleckner <rnk at google.com> wrote:
 >
 >> I work on LLVM and used to work on Dr. Memory, a memory debugger 
similar to Valgrind's Memcheck.  I think using LLVM as a Valgrind 
backend is probably feasible, but I highly doubt that LLVM will be able 
to generate code quickly enough to make it usable.  It might be 
worthwhile as a second level JIT, but usually the major downside to DBI 
tools is the startup overhead, and LLVM code generation can only 
increase that.
 >
 > It would also be interesting to cache the LLVM-generated code between 
runs, or even do it as an AOT pass.  A lot of the times I have problems 
where Valgrind would help, I end up needing multiple runs and each one 
takes several minutes of execution time (sometimes 5-10, because of the 
slowdown).  I've also found that for some applications, Valgrind's 
overhead makes it impossible to reproduce some timing issues and so the 
segfault just goes away if you run the code slower.
 >
 >

It is a very interesting idea! LLVM bitcode is easily serialized and 
deserialized to bitcode files, and these files can even be linked 
together. It can be quite useful if the serialization is also done in a 
JIT fashion, in order not to slow down too much the startup of the program.




More information about the llvm-dev mailing list