<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 4, 2018, at 9:33 PM, Alexandre Isoard via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Ah, yes, I should have provided an example:<div class=""><br class=""></div><div class=""><font face="monospace, monospace" class="">1: for(int i = 0; i < n/2; ++i)</font></div><div class=""><font face="monospace, monospace" class="">2: for(int j = 0; j < n; ++j)</font></div><div class=""><font face="monospace, monospace" class="">3: A[2*i+n*j] += A[2*i+1+n*j];</font></div><div class=""><br class=""></div><div class="">Let say, I have a loop interchange pass that decide it is better for spacial locality, to exchange those two loops.</div><div class="">It might print a diagnostic message:</div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">Deciding to perform loop interchange between outer-loop at line 1 and inner-loop at line 2. Accesses on A at line 3 have a stride of 2 along the outer-loop, which is shorter than the stride of %17 along the inner-loop.</blockquote><div class=""><br class=""></div><div class="">The reason why it says 2 and %17 is because that is the textual representation of SCEV representing the stride. Ideally, %17 would be expressed in terms of the original code, here "n". I could translate the "leaves" into their debug info, but what about {0,+,1}<%loop1> that I would like to spell, as a block: "i”?</div></div></div></blockquote>I think the best we can do here is to point to the corresponding loop (i.e. "{0,+,1}<%loop1>” ==> “iteration number of loop ‘at line 1: for(int i = 0’ i < n/2; ++i)’ ”). In general, we can not map SCEV expressions to some existing variables/constants in the source code, but in some cases we probably can recognize the meaning of a SCEV expression: e.g. iteration number or (maximum/minimum) trip count.</div><div><br class=""></div><div>For example, for a bubble-sort loop, looking like this:</div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div><font face="Menlo" class="">1: for (int i = 0; i < n; i++) {</font></div><div><font face="Menlo" class="">2: for (int j = 0; j < i; j++) {</font></div><div><font face="Menlo" class="">3: ...</font></div><div><font face="Menlo" class="">4: }</font></div><div><font face="Menlo" class="">5: }</font></div></blockquote><div>Some diagnostic might look like this:</div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div>Deciding to optimize loop at line 2 iterating up to loop at line 1 iteration number of times.</div><div><br class=""></div></blockquote><div>However, I admit it might look a bit clunky though :/</div><div><br class=""></div><div>Michael</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Jun 4, 2018 at 8:52 PM, Sanjoy Das<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:sanjoy@playingwithpointers.com" target="_blank" class="">sanjoy@playingwithpointers.co<wbr class="">m</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><span class="">On Mon, Jun 4, 2018 at 6:14 PM, Alexandre Isoard via llvm-dev<br class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class="">> - I would like to print meaningful expressions that does not involve llvm-ir<br class="">> variables.<br class=""><br class=""></span>I don't quite understand what you mean by this -- are you saying you<br class="">want to print SCEV expressions that have only constants at the leaves?<br class=""><br class="">In any case, some examples will be helpful.<br class=""><br class="">-- Sanjoy<br class=""><span class=""><br class="">><br class="">> I think the second problem is hard, how would you suggest to proceed?<br class="">><br class="">> --<br class="">> Alexandre Isoard<br class="">><br class=""></span>> ______________________________<wbr class="">_________________<br class="">> LLVM Developers mailing list<br class="">><span class="Apple-converted-space"> </span><a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">><span class="Apple-converted-space"> </span><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class="">><br class=""></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="m_1730256003733635848m_7671040924542770914gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><b class="">Alexandre Isoard</b><br class=""></div></div></div></div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">LLVM Developers mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="mailto:llvm-dev@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">llvm-dev@lists.llvm.org</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></div></blockquote></div><br class=""></body></html>