[llvm-dev] Is there a way to pass Optimization passes to clang?

Bill Seurer via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 4 11:04:34 PST 2015

On 12/04/15 12:18, Phil Tomson via llvm-dev wrote:
> How do you get llc to emit a .o file (I seem to only be able to get it
> to output a .s file)?

Here are some notes from the last time I did it that might be helpful. 
I was removing optimization passes looking for what was causing a problem.

clang -O2 -mllvm -disable-llvm-optzns -emit-llvm -c mysource.c -o 

opt ...specify_passes_here... mysource.llvm.bc -o mysource.llvm.ll

llc mysource.llvm.ll -filetype=obj -o mysource.llvm.o

To see all the passes opt would normally use:

opt -O2 -disable-output -debug-pass=Arguments mysource.llvm.bc

-Bill Seurer

More information about the llvm-dev mailing list