<div dir="ltr"><br><div>I figured out the same by compiling a test program to bitcode and then disassembling it. Thanks Don.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 11 October 2017 at 06:09, Don Hinton <span dir="ltr"><<a href="mailto:hintonda@gmail.com" target="_blank">hintonda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">If you want the value, you'll need to load it first, e.g., by using CreateLoad...<div><br></div><div>hth...</div><div>don</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 10, 2017 at 9:07 PM, Dipanjan Das via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div>To create a stack based (local) 64 bit integer in LLVM IR, I used: <div>Value *var = builder.CreateAlloca(Type::get<wbr>Int64Ty(Ctx)); </div><div><br></div><div>I wish to pass this variable to a function "void foo(unsigned long)". I created the signature of function foo() as follows:</div><div><div>Constant *func = M->getOrInsertFunction("foo", Type::getVoidTy(Ctx),Type::get<wbr>Int64Ty(Ctx), NULL);</div><div><br></div><div>To pass the newly created variable var to foo():</div><div><div>Value *args[] = {var};</div><div>builder.CreateCall(func, args);</div></div><div><br></div><div>However, LLVM backend throws assertion error: "Calling a function with a bad signature!"</div><div><br></div><div>If I print the types of the following:</div><div>errs() << *Type::getInt64Ty(Ctx) << ", " << *var->getType();</div><div><br></div><div>I can see first one is i64 and second one is i64*; hence the incompatibility. How can I create an alloca variable of type i64?</div><span class="HOEnZb"><font color="#888888"><span class="m_-4885751917480546656HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_-4885751917480546656m_-8776905729862705599gmail_signature"><div dir="ltr"><span><div><div dir="ltr"><p>Thanks & Regards,</p>
<div>Dipanjan</div></div></div></span></div></div>
</font></span></font></span></div></div><span class="HOEnZb"><font color="#888888">
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></font></span></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span><div><div dir="ltr"><p>Thanks & Regards,</p>
<div>Dipanjan</div></div></div></span></div></div>
</div>