Hello,<br><br>I have been trying to plugin a function into a loop using a LoopPass.<div>However, I get the error: <br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Referencing function in another module!<br>%2 = call i32 @test_print()</blockquote><div>and eventually a coredump. </div><br>Details are as follows:<div>There is a function called int test_print() {...}<br><div><br></div>

<div>It is being declared in the module using:</div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
func = mod->getOrInsertFunction("test_print", Type::getInt32Ty(ctx), (Type*)0);<br>
f = cast<Function>(func);</blockquote></div><div><br></div></div><div>The call instruction is being inserted using:</div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Instruction *newInst = CallInst::Create(f, "", topInst);</blockquote><div><br></div><div>Any help wrt this error would be really appreciated.</div><div>Thanks. </div></div><div><br></div><div>PS: Though similar, this is different from <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-August/042845.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-August/042845.html</a> as I do not make use of builder.</div>

</div>