<div dir="ltr">Better than my way, thank you Mehdi!<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 15, 2016 at 4:31 PM, Mehdi Amini 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 style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Dec 15, 2016, at 12:10 PM, Shen Liu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="m_7999882097012965001Apple-interchange-newline"><div><div dir="ltr"><div>Hi Ryan,<br><br></div>Thanks for your reply! Yes i can use llvm::Use.get() API to do this, i just want to know whether there's a better way(e.g. an existed API like getValue()) to make my code look more professional. <br></div></div></blockquote><div><br></div></span><div>CastInst->getOperand(0) ?</div><div><br></div><div>— </div><div>Mehdi</div><div><div class="h5"><div><br></div><div><br></div><div><br></div><br><blockquote type="cite"><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 15, 2016 at 2:58 PM, Ryan Taylor 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>This might help:</div><div><br></div><div><a href="http://llvm.org/docs/ProgrammersManual.html#the-value-class" target="_blank">http://llvm.org/docs/Programme<wbr>rsManual.html#the-value-class</a></div><div><br></div><div>Or maybe I'm misunderstanding what you mean by "efficient way to get the value". When you say 'value', I'm assuming you mean the class. In your case, AllocaInst inherits from value.</div><div><br></div><div>-Ryan</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_7999882097012965001h5">On Thu, Dec 15, 2016 at 10:24 AM, Shen Liu 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></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_7999882097012965001h5"><div dir="ltr"><pre style="white-space:pre-wrap"><font face="arial, helvetica, sans-serif"><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o">Hi everyone,<br><br>This is a simple question but is there an efficient way to get the <b>value for casting</b> directly from a bitcast instruction?<br><br>bitcast format :<</span><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-n">result</span><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o">></span> <span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o">=</span> <span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-n">bitcast</span> <span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><</span><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-n">ty</span><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o">></span> <span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><</span><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-n"><b>value</b></span><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o">></span> <span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-n">to</span> <span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><</span><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-n">ty2</span><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o">><br><br></span></font></pre><span><pre style="white-space:pre-wrap"><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><font face="arial, helvetica, sans-serif">For example, if i have <br><br>MemAddr<br>...<br>0x3d61238 %key = alloca [16 x i8], align 16<br>0x3d612a8 %plain_text = alloca [64 x i8], align 16<br>0x3d61318 %key1 = bitcast [16 x i8]* %key to i8*<br>...<br></font></span></pre><pre style="white-space:pre-wrap"><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><font face="arial, helvetica, sans-serif">The way i am using is processing all opcodes in %key1, and go back to find %key along the def-use chain. But is there a better way for doing this?<br></font></span></pre><pre style="white-space:pre-wrap"><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><font face="arial, helvetica, sans-serif">Thanks very much!<br><br></font></span></pre><pre style="white-space:pre-wrap"><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><font face="arial, helvetica, sans-serif">Best </font><span class="m_7999882097012965001m_-8122986283765427047m_-4109799569768806157gmail-HOEnZb"><font color="#888888"><br></font></span></span></pre></span></div>
<br></div></div>______________________________<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></blockquote></div><br></div>
<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></blockquote></div><br></div>
______________________________<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" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br></div></blockquote></div></div></div><br></div><br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">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></blockquote></div><br></div>