My language is producing a lot of very short functions, typically two or three instructions long. These should be ideal candidates for inlining, but it isn't happening. My compiler is producing one big bitcode file, and all the functions are marked as 'internal'. I'm then doing the optimisation and translation manually using llc -O3 into a .s file, and then linking this against the runtime using gcc. I see that llvm-ld supports an inlining pass; is this the *only* place it happens? i.e. do I need to run llvm-ld on my bitcode file before translation? If not, is there anything specifically I need to do in the compiler to make inlining happen? -- ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 262 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100922/a0a95be8/attachment.sig>
On Sep 22, 2010, at 9:54 AM, David Given wrote:> My language is producing a lot of very short functions, typically two or > three instructions long. These should be ideal candidates for inlining, > but it isn't happening. > > My compiler is producing one big bitcode file, and all the functions are > marked as 'internal'. I'm then doing the optimisation and translation > manually using llc -O3 into a .s file, and then linking this against the > runtime using gcc. >Are you running 'opt' on your bitcode or otherwise manually running those passes?> I see that llvm-ld supports an inlining pass; is this the *only* place > it happens? i.e. do I need to run llvm-ld on my bitcode file before > translation? If not, is there anything specifically I need to do in the > compiler to make inlining happen? > > -- > ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── > │ > │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } > │ --- Conway's Game Of Life, in one line of APL > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On 22/09/10 18:07, Jim Grosbach wrote: [...]> Are you running 'opt' on your bitcode or otherwise manually running those passes?Aha. After running opt I now have inlined (and much better) code. Previously I'd been using llc -O3 to do the optimisation. What's the different between opt -O3 and llc -O3, then? -- ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── │ "To be is to do" -- Nietzche │ "To do is to be" -- Sartre │ "Do be do be do" -- Sinatra -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 254 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100922/edc0df2c/attachment.sig>