<div dir="auto">Thanks Nikita,<div dir="auto">I'll try it and get back to you if I still have problem.</div><div dir="auto"><br></div><div dir="auto">Thanks a lot for your help</div><div dir="auto"><br></div><div dir="auto">Alberto</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 25, 2022, 08:25 Nikita Popov <<a href="mailto:nikita.ppv@gmail.com">nikita.ppv@gmail.com</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"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 25, 2022 at 8:00 AM Alberto Barbaro via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" rel="noreferrer">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi all,</div><div>so I'm trying to understand how to manually calculate the offset calculated by a GEP instruction. I found that this question was asked over 6 years ago on stackoverflow[1] as well but never got a real answer.</div><div><br></div><div>Since I need exactly the same, is there anyone willing to help me to understand how to calculate the offset?<br>
</div></div></blockquote><div><br></div><div>You can use GEPOperator::accumulateConstantOffset(). Or more generically, there is Value::stripAndAccumulateConstantOffsets(), which can look through multiple GEPs, bitcasts, etc.</div><div><br></div><div>Regards,</div><div>Nikita <br></div></div></div>
</blockquote></div>