[LLVMdev] Using argument in another module

ChiaLun h3355626 at msn.com
Tue Dec 25 21:15:48 PST 2012

Hi everyone,

  I am building a function that would call a function in another module,

I found this related thread


All my functions have prototype

int f(myStruct * c);

here comes my problems

If I have Function* f1,*f2

f2 is in another module, f1 is the function I am building.

Somewhere in f1 , I set

builder.CreateCall(f2,f1->arg_begin());                // builder is
IRBuilder, its context is the same as f1

When I run my program, I get

llvm/lib/VMCore/Instructions.cpp:274: void
llvm::CallInst::init(llvm::Value*, llvm::ArrayRef<llvm::Value*>, const
llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i)
== Args[i]->getType()) && "Calling a function with a bad signature!"'

I found another thread having the same problem


It says that the problem results from parameter in different context.

In that thread, it's still unsolved.

The reason I have this problem is that I am using many threads to create and
build LLVM functions, each thread

has its own LLVMContext, and they may execute functions built by other

Does anyone have idea on how to solve that ?

Have A Nice Day

Chia Lun Liu

View this message in context: http://llvm.1065342.n5.nabble.com/Using-argument-in-another-module-tp52849.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.

More information about the llvm-dev mailing list