<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 15, 2016, at 12:10 PM, Shen Liu via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hi Ryan,<br class=""><br class=""></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 class=""></div></div></blockquote><div><br class=""></div><div>CastInst->getOperand(0) ?</div><div><br class=""></div><div>— </div><div>Mehdi</div><div><br class=""></div><div><br class=""></div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Dec 15, 2016 at 2:58 PM, Ryan Taylor via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class="">This might help:</div><div class=""><br class=""></div><div class=""><a href="http://llvm.org/docs/ProgrammersManual.html#the-value-class" target="_blank" class="">http://llvm.org/docs/<wbr class="">ProgrammersManual.html#the-<wbr class="">value-class</a></div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">-Ryan</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote"><div class=""><div class="h5">On Thu, Dec 15, 2016 at 10:24 AM, Shen Liu via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><div class="h5"><div dir="ltr" class=""><pre style="white-space:pre-wrap" class=""><font face="arial, helvetica, sans-serif" class=""><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o">Hi everyone,<br class=""><br class="">This is a simple question but is there an efficient way to get the <b class="">value for casting</b> directly from a bitcast instruction?<br class=""><br class="">bitcast format :<</span><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-n">result</span><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o">></span> <span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o">=</span> <span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-n">bitcast</span> <span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><</span><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-n">ty</span><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o">></span> <span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><</span><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-n"><b class="">value</b></span><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o">></span> <span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-n">to</span> <span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><</span><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-n">ty2</span><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o">><br class=""><br class=""></span></font></pre><span class=""><pre style="white-space:pre-wrap" class=""><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><font face="arial, helvetica, sans-serif" class="">For example, if i have <br class=""><br class="">MemAddr<br class="">...<br class="">0x3d61238 %key = alloca [16 x i8], align 16<br class="">0x3d612a8 %plain_text = alloca [64 x i8], align 16<br class="">0x3d61318 %key1 = bitcast [16 x i8]* %key to i8*<br class="">...<br class=""></font></span></pre><pre style="white-space:pre-wrap" class=""><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><font face="arial, helvetica, sans-serif" class="">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 class=""></font></span></pre><pre style="white-space:pre-wrap" class=""><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><font face="arial, helvetica, sans-serif" class="">Thanks very much!<br class=""><br class=""></font></span></pre><pre style="white-space:pre-wrap" class=""><span class="m_-8122986283765427047m_-4109799569768806157gmail-m_2283657932595577751gmail-o"><font face="arial, helvetica, sans-serif" class="">Best </font><span class="m_-8122986283765427047m_-4109799569768806157gmail-HOEnZb"><font color="#888888" class=""><br class=""></font></span></span></pre></span></div>
<br class=""></div></div>______________________________<wbr class="">_________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class="">
<br class=""></blockquote></div><br class=""></div>
<br class="">______________________________<wbr class="">_________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></body></html>