<div dir="ltr">Adding llvm-dev.<div><br></div><div>I don't know if this is readily available in LLVM but here is what you could do something like below.</div><div><br></div><div><font face="monospace, monospace">worklist = NULL</font></div><div><span style="font-family:monospace,monospace">for each loop L in function {</span><br></div><div><font face="monospace, monospace">  for each block B in L {</font></div><div><font face="monospace, monospace">     for each Inst I in B {</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">        if (I.use_empty()) </font></div><div><font face="monospace, monospace">           continue; </font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">        for each use of I {<br></font></div><div><font face="monospace, monospace">            B1 = I.getParent();</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace">           if (L.contains(B))</font></div><div><font face="monospace, monospace">                continue;</font></div><div><font face="monospace, monospace">            </font></div><div><font face="monospace, monospace">            worklist.add(I)</font></div><div><font face="monospace, monospace">            break;</font></div><div><font face="monospace, monospace">        }      </font></div><div><font face="monospace, monospace">     }</font></div><div><font face="monospace, monospace">   }</font></div><div><font face="monospace, monospace">}</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">Similar thing seems to be in </font><span style="font-family:arial,helvetica,sans-serif">Transforms/Utils/LCSSA.cpp</span></div><div><font face="arial, helvetica, sans-serif"><br></font></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 7, 2017 at 11:01 AM, Shail Dave via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><div class="m_582972944398335090WordSection1"><p class="MsoNormal">Hi,<br><br>Thank you for your time in reading this. I need help in analyzing the live-in and live-out variables for few loops in the llvm IR. I want to figure out which is a live-variable at the end of the loop and what is live-in variable for the loop. I found that such provisions are available for machine instructions. But, I have to use this at IR level. I found few papers showing algorithms to construct such analysis but, it seems to me that this must be a problem encountered before and there should be at least similar functionalities in some of the analyses passes in the existing LLVM framework. It would be great if I can find some references or someone can give some suggestions.<br><br>If I cannot find some existing passes, I am also not sure about – how can I make use of Intrinsic::invariant_start or Intrinsic::lifetime_start for aforementioned purpose. Any help is highly appreciated. Thanks!<br><br><u></u><u></u></p><p class="MsoNormal">Best,<br><b><span style="font-size:10.0pt;font-family:"Segoe Script";color:#0d0d0d">Shail</span></b><span style="font-family:"Segoe Script""><u></u><u></u></span></p></div></div><br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_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>