Thanks Duncan. Just to make sure I understand correctly, opt has more global
information, due to which optimizations can have greater effect than in
llvm-gcc, where optimizations are applied on a per-function basis. Is this
correct ?
----- Original Message -----
From: "Duncan Sands" <baldrick at free.fr>
To: llvmdev at cs.uiuc.edu
Sent: Tuesday, December 13, 2011 2:46:23 AM
Subject: Re: [LLVMdev] Optimization application by llvm-gcc, opt
Hi RaghuB,
> I wanted to clarify something about the application of optimizations by
llvm-gcc, opt and llc.
>
> Will the following two sequences generate the same optimized bitcode?
> a) $ llvm-gcc -O3 -c -emit-llvm foo.c -o foo.bc
> b) $ llvm-gcc -O0 -c -emit-llvm foo.c -o foo.bc
> $ opt -O3 foo.bc
not necessarily, though usually it is the same. One reason for this is that
the per-function passes run by llvm-gcc are used to clean up functions as they
are output, while with opt they are run after the entire module has been
generated. The difference is that when a function is output some things like
global variables may have only been partially output (eg may not have an initial
value yet) resulting in less or different optimization.
Ciao, Duncan.
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev