[LLVMdev] Argument's types mismatch when creating CallInst.

arrowdodger 6yearold at gmail.com
Fri Nov 11 00:18:54 PST 2011


Hello. I have an .bc, which defines @foo(%type* arg1, %type* arg2, %type*
arg3).
Firstly, i do this:

runtimeModule = getLazyIRFileModule("runtime.bc", smd, llctx);

then this:

fooFunction = runtimeModule->getFunction("foo");
myType = runtimeModule->getTypeByName("type");

After that, i'm creating another module:

myModule = new Module("My Module", llctx);

and create some AllocaInsts with type %type:

AllocaInst * retZval = new AllocaInst(myType,
                                          "arg1",
                                          currentBB);

Finally, i do

CallInst::Create(fooFunction, args_vector, "", currentBB);

Everything seems to be fine so far.
Now i link two modules together and run Verifier:

llvm::Linker linker("myModule", runtimeModule);
linker.LinkInModule(myModule, &err);
llvm::verifyModule(*linker.releaseModule());

This gives me error:
Call parameter type does not match function signature!
  %"arg1" = alloca %type
 %"type 0x801e9b550"*  %0 = call i32 @foo(%type* %"~3", %type* %"arg2",
%type* %"arg3")

What's interesting - if i dump myModule before verifying, manually put @foo
and %type definitions into it, then opt -verify do not complain.

Am i doing something wrong or is it a bug?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111111/ef8d8668/attachment.html>


More information about the llvm-dev mailing list