<div dir="ltr">If you want to look through bitcasts and other no-op pointer type changes, use Value::stripPointerCasts.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 14, 2016 at 9:19 PM, 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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><pre><span class="m_-1234116248554806985gmail-o">Hi everyone,<br><br>This is a simple question but is there an efficient way to get the value directly from a bitcast instruction?<br><br><</span><span class="m_-1234116248554806985gmail-n">result</span><span class="m_-1234116248554806985gmail-o">></span> <span class="m_-1234116248554806985gmail-o">=</span> <span class="m_-1234116248554806985gmail-n">bitcast</span> <span class="m_-1234116248554806985gmail-o"><</span><span class="m_-1234116248554806985gmail-n">ty</span><span class="m_-1234116248554806985gmail-o">></span> <span class="m_-1234116248554806985gmail-o"><</span><span class="m_-1234116248554806985gmail-n">value</span><span class="m_-1234116248554806985gmail-o">></span> <span class="m_-1234116248554806985gmail-n">to</span> <span class="m_-1234116248554806985gmail-o"><</span><span class="m_-1234116248554806985gmail-n">ty2</span><span class="m_-1234116248554806985gmail-o">><br><br></span></pre><pre><span class="m_-1234116248554806985gmail-o">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></span></pre><pre><span class="m_-1234116248554806985gmail-o">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></span></pre><pre><span class="m_-1234116248554806985gmail-o">Thanks very much!<br><br><br></span></pre><pre><span class="m_-1234116248554806985gmail-o">Best <span class="HOEnZb"><font color="#888888"><br><br></font></span></span></pre><span class="HOEnZb"><font color="#888888"><pre><span class="m_-1234116248554806985gmail-o">Shen<br> </span></pre><pre><span class="m_-1234116248554806985gmail-o"><br><br></span><span class="m_-1234116248554806985gmail-p"></span><span class="m_-1234116248554806985gmail-n"></span><span class="m_-1234116248554806985gmail-n"></span></pre></font></span></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>