[LLVMdev] force inlineing a function using opt

Criswell, John T criswell at ad.uiuc.edu
Tue Jan 4 18:04:25 PST 2011


If I understand correctly, you're saying that the C source definition of the prologue function is declared as static.  If you compile that function to LLVM IR, it will get interal linkage and will not be visible to functions in other compilation units; instead, it will get renamed if there is a function defined with the same name.  As such, it will never get inlined as the instrumented code will be calling a "different" function.

Try making the C source definition externally visible (i.e., remove the static keyword) and see if it fixes the problem.

-- John T.

________________________________________
From: llvmdev-bounces at cs.uiuc.edu [llvmdev-bounces at cs.uiuc.edu] On Behalf Of Hari Pyla [harip at vt.edu]
Sent: Tuesday, January 04, 2011 4:19 PM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] force inlineing a function using opt

Hi,
  I am instrumenting the stores in a program by inserting a function
call (store_prologue) before every store instruction in the IR file. I
set the prologue function's attribute to "AlwaysInline" using
addFnAttr(). In the program the prologue function is defined as static
inline. I am using opt to generate an optimized (inline the calls to the
store prologue) using the following options "-always-inline". I also
tried "-inline". However, the calls to the prologue function are not
inlined. I was wondering if I am doing something wrong?. Is there any
way to force inline a function. I really appreciate your help.

  Best,
  --Hari



_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list