[LLVMdev] Questions regarding using LLVM for static code analysis

Chris Lattner sabre at nondot.org
Tue Oct 10 15:11:29 PDT 2006

On Tue, 10 Oct 2006, Shirish Seetharam (sseethar) wrote:
>    I am looking into the possibility of using the the LLVM
> infrastructure for static code analysis. Specifically I am trying to
> understand the object mod/ref relationships between modules (which are a
> set of C/C++ files). I plan to generate the .o and .bc files (using
> CC=llvm-gcc) and then run "opt" on the .bc file to display the
> information. One of the things I noticed was that some of the optimizer
> phases had already transformed the code, so the dependency had moved to


> another function. I wanted to know if there is a simple way to disable
> all the optimizing transformations ?  I am also interested in knowing
> how scalable this approach (generating the .o and the .bc and then using
> opt) is going to be ? The source I am looking is fairly large (several
> million lines of code).

If you're using llvm-gcc4, passing -O0 should be sufficient.  If you're 
using llvm-gcc3, please see:



More information about the llvm-dev mailing list