[LLVMdev] Can I disable the optimizaiton for llvmgcc?

Misha Brukman brukman at uiuc.edu
Fri May 14 13:45:02 PDT 2004


On Fri, May 14, 2004 at 11:39:39AM -0700, Zhang Qiuyu wrote:
> I just tried to compile a simple code and analyze the number of the
> basic blocks. But after compile, what I got, the bytecode is seems to
> be optimized bytecode. So the information of basic blocks is not what
> I expected. I want ot use the code as example to see how some of code
> optimization methods work. However, after compiling file using llvm
> test.c -o test,  bytecode file test.bc is optimized ( llvm-dis<
> test.bc). Does it mean there is default optimaztion option when
> running llvmgcc and can I disable the option for optimiztion? 

Yes, by default, llvm-gcc will run gccas after compiling C/C++ to LLVM
assembly, then gccas will assemble the code and run various
optimizations on it.

To see a list of passes gccas will run on your code:

  gccas -debug-pass=Arguments < /dev/null -o - > /dev/null
 
To disable running these optimizations on your code:

  llvm-gcc -S file.c
  llvm-as < file.s > file.bc

The -S produces just the assembly that llvm-gcc would normally produce
and inhibits running gccas on that code.  llvm-as is a pure assembler,
where as gccas is an optimizing assembler built to clean up after the
code that llvm-gcc produces, which includes simplifying the CFG, so you
are seeing basic blocks go away.

-- 
Misha Brukman :: http://misha.brukman.net :: http://llvm.cs.uiuc.edu



More information about the llvm-dev mailing list