Suresh Purini
2011-Jun-08 12:14 UTC
[LLVMdev] Different Runtimes using clang-gcc and clang-opt-llc-gcc
Hello, I have trouble compiling programs using clang on Ubuntu-Natty (getting some linker errors). So I generated a object file using "-c" and then used gcc to generate the final executable. It worked fine. I tried the following method also: $ clang -O0 -c -flto foo.c $ llc foo.o $ gcc foo.o.s It also worked. However the problem is I am getting different runtimes using the two different methods. The executable generated using the second method is running faster than the one generated using the first method. I am confused as in both cases I am using -O0. In general if I want measure runtimes which of the two methods is more accurate. Thanks in advance. -Suresh PS: Is there any fix for the linker errors generated by clang on Natty.
Duncan Sands
2011-Jun-08 12:49 UTC
[LLVMdev] Different Runtimes using clang-gcc and clang-opt-llc-gcc
Hi Suresh,> $ clang -O0 -c -flto foo.c > $ llc foo.o^ llc defaults to -O2> $ gcc foo.o.sCiao, Duncan.
Jim Grosbach
2011-Jun-08 16:14 UTC
[LLVMdev] Different Runtimes using clang-gcc and clang-opt-llc-gcc
On Jun 8, 2011, at 5:49 AM, Duncan Sands wrote:> Hi Suresh, > >> $ clang -O0 -c -flto foo.c >> $ llc foo.o > > ^ llc defaults to -O2Yep. Exactly right. Specifically, the code generator and register allocator behave differently at -O0, sacrificing generated code quality to get better debugging information and compile-time performance. That said, running things this way, most of the mid-level optimizations that would normally be applied at -O2 still aren't as they're not part of llc.> >> $ gcc foo.o.s > > Ciao, Duncan. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev