[LLVMdev] x86: inline an LLVM IR function?

Joey Gouly joel.gouly at gmail.com
Sun Dec 1 11:03:17 PST 2013


You should use "opt" with -inline, or -O2/3 to optimise this.
llc only runs backend optimisations.



On 1 December 2013 18:51, Mikael Lyngvig <mikael at lyngvig.org> wrote:

> Sorry for what may possibly be a rather stupid question, but how on earth
> do you make LLC inline a function?  I've got this code:
>
>    attributes 0 = { alwaysinline nounwind }
>
>    define internal i32 @lambda(i32 %a, i32 %x) #0 {
>       %1 = add i32 %a, %x
>       ret i32 %1
>    }
>
>    define i32 @foo(i32 %a) nounwind {
>       %1 = call i32 @lambda(i32 %a, i32 10)
>       ret i32 %1
>    }
>
> And no matter what I do, the function @lambda ends up being called with a call instruction.  I've tried with -O2, -O3, and with and without the alwaysinline attribute.
>
> How do I get LLC or Clang to inline the above @lambda function?
>
> Thanks in advance!
>
>
> -- Mikael
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131201/10f096f0/attachment.html>


More information about the llvm-dev mailing list