David Dunkle
2010-Jan-28 23:38 UTC
[LLVMdev] function inlining of llvm-gcc versus gcc, and llvm-g++ versus g++?
Does llvm-gcc do more, less, or the same amount of function inlining as gcc? What about llvm-g++ and g++? I am specifically interested in inlining that occurs when I run with the --emit-llvm command line flag like this: llvm-gcc -c --emit-llvm foo.c thus generating bitcode. That is, I am not interested at this moment in what happens when I run the opt or llc tools on the bit code after its omitted, I am just focusing on the inlining that has occurred up until the point that the bitcode is emitted. I am trying to find this information about using the tools themselves, but it would be great if there is a known answer so I can cut short the process. thanks, -David -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100128/65c71b77/attachment.html>
Duncan Sands
2010-Jan-29 08:35 UTC
[LLVMdev] function inlining of llvm-gcc versus gcc, and llvm-g++ versus g++?
Hi David,> Does llvm-gcc do more, less, or the same amount of function inlining as > gcc? What about llvm-g++ and g++?this is a hard question to answer, since it depends hugely on what the code being compiled is and what versions of gcc and LLVM you are using. The gcc developers work actively on the inliner, and it has changed hugely between (say) gcc-4.2 and the latest version of gcc. The changes to the LLVM inliner between versions have been less dramatic, but nonetheless significant. My understanding is that typically the latest llvm-gcc inlines less than gcc-4.2; I don't know how it compares to gcc-4.5. I suggest you experiment yourself.> I am specifically interested in inlining that occurs when I run with the > --emit-llvm command line flag like this: > > llvm-gcc -c --emit-llvm foo.cNo inlining occurs when you run like that because you didn't specify an optimization level. If you want the maximum amount of inlining try adding -O3 to the command line. You will also get some inlining at lower optimization levels (including -Os).> thus generating bitcode. That is, I am not interested at this moment in > what happens when I run the opt or llc tools > on the bit code after its omitted, I am just focusing on the inlining > that has occurred up until the point that the bitcode > is emitted.It used to be that if you specified (eg) -O2 then the gcc parts of llvm-gcc would do some inlining before the gcc -> llvm conversion kicked in. I'm pretty sure this was already no longer the case in llvm-gcc from the LLVM 2.6 release, i.e. all inlining is now done by the LLVM optimizers. You can do this: llvm-gcc -c --emit-llvm foo.c -O3 -mllvm -disable-llvm-optzns to see the bitcode without LLVM optimizations, and llvm-gcc -c --emit-llvm foo.c -O3 to see it with optimization. Ciao, Duncan.
Apparently Analagous Threads
- [LLVMdev] Disable all inlining in llvm-gcc/llvm-g++
- [LLVMdev] Inlining and exception handling in LLVM and GCC
- [LLVMdev] Inlining and exception handling in LLVM and GCC
- [LLVMdev] Inlining and exception handling in LLVM and GCC
- [LLVMdev] Inlining and exception handling in LLVM and GCC