<div dir="ltr">Hi,<div class="gmail_extra"><br><div class="gmail_quote">On 30 May 2018 at 18:09, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><span class="">
<br>
<div class="m_-2534057247837453143moz-cite-prefix">On 05/30/2018 06:04 AM, Siddharth Bhat
via llvm-dev wrote:<br>
</div>
<blockquote type="cite">
You can run SCEV which will see through bitcasts and GEPs, so it
should give an expression of the form (base + offset) on the
pointer of the load.</blockquote>
<br></span>
Specifically, you can use ScalarEvolution to subtract the expression
for the base descriptor from the expression for the loaded pointer
and see if the result is a SCEVConstant.<br>
<br>
Also, you might find GetPointerBaseWithConstantOffs<wbr>et (in
ValueTracking.h) useful.<br>
<br>
-Hal</div></blockquote><div><br></div><div><br></div><div>Thank you, I will try using SCEV. </div><div><br></div><div>regards,</div><div>Venkat.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><div><div class="h5"><br>
<br>
<blockquote type="cite">
<div><br>
</div>
<div>Cheers</div>
<div>siddharth</div>
<div><br>
<div class="gmail_quote">
<div dir="ltr">On Wed 30 May, 2018, 16:30 Venkataramanan Kumar
via llvm-dev, <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi,
<div><br>
</div>
<div>Below is the snippet of LLVM IR code generated by
Flang </div>
<div><br>
</div>
<div>---snip--</div>
<div> %3 = getelementptr i64, i64* %"a$sd", i64 11, !dbg
!16<br>
</div>
<div>
<div> %4 = bitcast i64* %3 to i32*, !dbg !16</div>
<div> %5 = load i32, i32* %4, align 4, !dbg !16, !tbaa
!22</div>
</div>
<div>---snip--</div>
<div><br>
</div>
<div>My requirement is for any such LoadInst (example:
%5), I want to check if its base GEP (i.e. %3) loads at
particular offset (11) from its corresponding arrays
descriptor structure (a$sd).</div>
<div><br>
</div>
<div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">is
there any API in LLVM to check this? or I need to
write my own?</div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><br>
</div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">regards,</div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">Venkat.</div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><br class="m_-2534057247837453143m_6311213337484395444gmail-Apple-interchange-newline">
</div>
</div>
<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>
</blockquote>
</div>
</div>
-- <br>
<div dir="ltr" class="m_-2534057247837453143gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">Sending this from my phone, please excuse any
typos!</div>
</div>
<br>
<fieldset class="m_-2534057247837453143mimeAttachmentHeader"></fieldset>
<br>
<pre>______________________________<wbr>_________________
LLVM Developers mailing list
<a class="m_-2534057247837453143moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>
<a class="m_-2534057247837453143moz-txt-link-freetext" 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>
</pre>
</blockquote>
<br>
</div></div><span class="HOEnZb"><font color="#888888"><pre class="m_-2534057247837453143moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</font></span></div>
</blockquote></div><br></div></div>