[LLVMdev] LLVM IR for inline functions

Zhoulai zell08v at gmail.com
Sat Apr 18 18:36:25 PDT 2015


Hi,

I have a naive question on how to generate LLVM IR for inline functions. I
have compiled this C code:

*inline void func1()*
* {*
* int x=3;*
* }*
* void func2()*
* {*
* func1();*
* int y = 4;*

* }*

into LLVM IR, using

clang -emit-llvm -S -c <filename>

But the generated LLVM IR file does *not* have func1() expanded (see below
for the relevant parts).

*; Function Attrs: nounwind uwtable*
* define void @func2() #0 {*
* entry:*
* %y = alloca i32, align 4*
* call void (...)* @func1()*
* store i32 4, i32* %y, align 4*
* ret void*
* }*

* declare void @func1(...) #1*

Question: Do I need to pass some special command line options so to make
func1() expanded in the LLVM IR? Thanks.

Zhoulai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150418/e8896267/attachment.html>


More information about the llvm-dev mailing list