[LLVMdev] Query on llvm-gcc v/s llc/as

Samuel Crow
Fri, 17 Sep 2010 18:34:31 -0000

Hi Raghu,

I think the difference lies in the fact that llc has 4 as its maximum
optimization level to allow link-time optimization.  If this is what you're
noticing, then the second should be modified to "llc -O4 test.bc -o
test.s".  I
could be wrong though.

--Sam


----- Original Message ----
> From: Raghu Prabhakar <raghu at cs.ucla.edu>
> To: llvmdev at cs.uiuc.edu
> Sent: Fri, September 17, 2010 1:10:54 PM
> Subject: [LLVMdev] Query on llvm-gcc v/s llc/as
>
> Hi all,
>
> I have started using LLVM recently, and I have a basic question.  There are
two
>different ways in which an executable can be generated from a .c  file - by
just
>using llvm-gcc, and using a combination of llvm-gcc (to emit  bitcode .bc),
llc
>(to emit assembly code), as (to assemble the code) and  collect2 (linker).
For
>example, consider compiling test.c :
>
> 1) llvm-gcc  -O3 test.c -o testExecutable
>
> 2) llvm-gcc -O3 -emit-llvm -c test.c -o  test.bc
>    llc -O3 test.bc -o test.s
>    as test.s -o  test.o
>    gcc test.o -o testExecutable2
>
> My question is, are the  two executables (testExecutable and
testExecutable2)
>basically the same ? Is  there any huge difference between the two processes
>which will impact the  executable's running time ? I am asking this
because I
>compared the executables  by their wordcounts (wc -c), and there was a
slight
>difference. However, when I  timed the test runs, both performances were
>identical.
>
> Kindly help me out  on  this.
>
> Thanks.
> Raghu.
> _______________________________________________
> LLVM  Developers mailing list
> LLVMdev at cs.uiuc.edu           http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>