<div dir="ltr"><div><div>Hello Pierre, <br></div><div>Great!!!<br></div>Thanks for your recommendation, <br></div>Bernard<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 31, 2016 at 12:59 PM, Pierre Gagelin <span dir="ltr"><<a href="mailto:up833083@myport.ac.uk" target="_blank">up833083@myport.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<p>Hi, just a remark in your code below<br>
</p><span class="">
<blockquote type="cite">
<div dir="ltr">
<div>
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<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>
<div dir="ltr">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))
{
<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>;
</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.
}
</pre></div></div></div></blockquote></div></div></div></blockquote></div></div></div></div></blockquote></span>dyn_cast does the job of isa already (and the job of cast if isa is true), here you better do this directly:
<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>( <span style="color:rgb(0,128,128)">GetElementPtrInst </span>*GEP = dyn_cast<<span style="color:rgb(0,128,128)">GetElementPtrInst</span>>(&<wbr>instruction) ) {
// processing on GEP
}
</pre>And beware of your isa: it should operate on a pointer to an instruction, not the instruction instance itself (just like for dyn_cast).
Hope that helps,
Pierre
</div></blockquote></div><br></div>