<div dir="ltr">Hi Ees,<br><br>Just to be sure: I understand that you are _not_ looking for a tutorial on the theoretical aspect<div>of how SCEV / LoopInfo work or what they try to do (e.g. what does the {0,+,1} mean or</div><div>how loops are identified etc.). If you're looking for those too, please let me know.</div><div><br></div><div>So, IIUC, you are looking for examples on how to use the APIs. There are very good real-world examples here and there</div><div>but you'd have to understand the context. For example, DependenceAnalysis has very clear usage</div><div>of both (especially SCEV). But you'd have to care for DA or to know its background already so that you</div><div>understand what it tries to do with SCEV. If you're interested in such examples, let me know.</div><div><br></div><div>If you're not, I would propose that you get a clone of LLVM and create</div><div>a dummy pass (e.g. like this: <a href="https://github.com/baziotis/llvm-project/commit/fdd94be9c266e5d3eb39d4b9f1362b5f7837a59a">https://github.com/baziotis/llvm-project/commit/fdd94be9c266e5d3eb39d4b9f1362b5f7837a59a</a>, ignore</div><div>any of my naming, you can concentrate only in the ::run() function) and just experiment.</div><div><br></div><div>That is, get LoopInfo analysis results, loop over the loops, get preheaders, get latches, etc. Then also,</div><div>iterate over code, find pointers, try to getSCEV() them. Then try to also getSCEVAtScope(). Try to get the steps, starts, exit count,</div><div>evaluateAtIteration() etc. Furthermore, see the different kinds of expressions, recurse at the expr tree, inspect the wrap flags.</div><div><br></div><div>The list goes on and on... It depends on what you're interested in. As you're experimenting, if something is not clear,</div><div>you can always ask in llvm-dev.</div><div><br></div><div>Best,<br>Stefanos</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Στις Τρί, 13 Οκτ 2020 στις 12:16 μ.μ., ο/η Ees via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> έγραψε:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Are there any tutorials/examples on usages of SCEV and/or LoopInfo? I <br>
know i can look up the source but i was thinking of something more <br>
contrived perhaps, to get some introduction on how to use/apply the APIs.<br>
<br>
Ees<br>
<br>
_______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>