<div dir="ltr">To be clear, I was suggesting to read the code in simplifyLoopIVs() in "lib/Transforms/Utils/<wbr>SimplifyIndVar.cpp" to see how it identifies IVs. (as opposed to calling the function to change the code).<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 16, 2016 at 12:48 PM, Ehsan Amiri <span dir="ltr"><<a href="mailto:ehsanamiri@gmail.com" target="_blank">ehsanamiri@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><div>If you have a canonicalized IV, you can use Loop::<wbr>getCanonicalInductionVariable(<wbr>) declared in "include/llvm/Analysis/<wbr>LoopInfo.h".<br><br>Otherwise you probably need to start from  function simplifyLoopIVs() in "lib/Transforms/Utils/<wbr>SimplifyIndVar.cpp". This method looks at all phi nodes in the header of the loop, but later on in the process, it skips some of them. For example, when we reach SimplifyIndvar::simplifyUsers(<wbr>), in the beginning of this function we check if the IV data type isSCEVable() or not. If not, we immediately return. <br><br></div>Hope that helps<br></div>Ehsan<br><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Sun, Oct 16, 2016 at 6:38 AM, Madhur Amilkanthwar 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi,<div>How does LLVM identify induction variables of a loop?</div><div>Is the algorithm based on SSA graphs?</div><div><br></div><div>I have a complicated loop and I need to do some analysis around it.</div><div>Can anyone please point me to source of identification part?</div><span class="m_-432167481771994081HOEnZb"><font color="#888888"><div><br></div><div> <br><div><div><br></div>-- <br><div class="m_-432167481771994081m_495120176221089421m_-3033644246280892838gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><i style="font-size:12.8px">Disclaimer: Views, concerns, thoughts, questions, ideas expressed in this mail are of my own and my employer has no take in it. </i><br></div><div>Thank You.<br>Madhur D. Amilkanthwar<br><br></div></div></div>
</div></div></font></span></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>
</blockquote></div><br></div>