<div dir="ltr"><div>Hi Tim,</div><div>as always thanks for your help. Unfortunately I made a mistake in my email but apart from that I still have problems.<br></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno sab 27 lug 2019 alle ore 11:53 Tim Northover <<a href="mailto:t.p.northover@gmail.com">t.p.northover@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Alberto,<br>
<br>
On Sat, 27 Jul 2019 at 10:09, Alberto Barbaro via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> Having the reference I to the instruction in bold.Can i efficiently know that the variable %11 was "created" by the %3 = alloca [40 x i8], align 16.<br>
<br>
Yes, I.getOperand(0) *is* the AllocaInst in this case. So for example<br>
isa<AllocaInst>(I.getOperand(0)) will return true. And if you care<br>
about more details you can dyn_cast<AllocaInst> it and check any other<br>
properties you want.<br>
<br></blockquote><div><br></div><div>I would like to use the approach you described considering I to be a reference to the icmp instruction ( %13 = icmp eq i32 %12, 66 ). From what I understood i should do something like:</div><div><br></div><div>Instruction* source;<br> <br> if(source = dyn_cast<AllocaInst>(I.getOperand(0))) {<br> cout << "Alloca Inst" << endl;<br> I.dump();<br> getchar();<br> }</div><div><br></div><div>I thought I.getOperand(0) was a reference to the instruction that have created %12. What am I missing?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Cheers.<br>
<br>
Tim.<br></blockquote><div><br></div><div>Thanks again</div><div>Alberto<br></div></div></div>