<div dir="ltr">Thanks Ryan, I'm able to retrieved the type using the following code:<br><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"dejavu sans mono";font-size:9pt"><span style="color:rgb(0,128,128)">Type </span>*type=getElementPtrInst->getSourceElementType();</pre><br><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 12, 2016 at 7:00 PM, Ryan Taylor <span dir="ltr"><<a href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@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"><div>Take a look at visitGetElementPtrInst in InstructionCombining.cpp for some examples about how to iterate over GEP and check for type.</div><div><br></div><div><a href="http://llvm.org/docs/doxygen/html/InstructionCombining_8cpp_source.html#l01334" target="_blank">http://llvm.org/docs/doxygen/<wbr>html/InstructionCombining_<wbr>8cpp_source.html#l01334</a></div><div><br></div><div>Hope I understood your question correctly.</div><div><br></div><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Fri, Aug 12, 2016 at 6:34 AM, Bernard Nongpoh 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:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div><div class="h5"><div dir="ltr"><div><div>Hello,<br></div>consider the following IR code :<br>%count4 = getelementptr inbounds %struct.r32, %struct.r32* %cur.087, i64 0, i32 4<br><br></div>How to check in the instruction, whether the operand is a structure or not <br><br><pre style="color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt;background-color:rgb(255,255,255)"><span style="color:rgb(0,0,128);font-weight:bold">if</span>(isa<<span style="color:rgb(0,128,128)">GetElementPtrInst</span>>(inst<wbr>ruction))<br>{<br><span style="color:rgb(0,128,128)">GetElementPtrInst </span>*getElementPtrInst=dyn_cast<<span style="color:rgb(0,128,128)">Ge<wbr>tElementPtrInst</span>>(&instruction)<wbr>;<br></pre><pre style="color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt;background-color:rgb(255,255,255)">//check if getElemetPtrInst operands structure or array.<br><br>}<br><br></pre><pre style="color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt;background-color:rgb(255,255,255)">Thank You<br><br></pre><pre style="color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt;background-color:rgb(255,255,255)">regards,<br></pre><pre style="color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt;background-color:rgb(255,255,255)">Bernard Nongpoh<br></pre><pre style="color:rgb(0,0,0);font-family:"DejaVu Sans Mono";font-size:9pt;background-color:rgb(255,255,255)"><br></pre><br></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></div>
</blockquote></div><br></div></div></div>