<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 7/16/21 9:29 AM, Jingu Kang wrote:<br>
</div>
<blockquote type="cite"
cite="mid:VE1PR08MB46703D0BDC5DA20A0BDF71F199119@VE1PR08MB4670.eurprd08.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:"Malgun Gothic";
panose-1:2 11 5 3 2 0 0 2 0 4;}@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}@font-face
{font-family:"\@Malgun Gothic";}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
font-size:10.0pt;
font-family:"Courier New";}span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p>Hi Philip,<o:p></o:p></p>
<p>Thanks for your kind reply.<o:p></o:p></p>
<p>> A) Are you measuring on tip of tree?� There were
changes for multiple exit unrolling which landed very
recently.<o:p></o:p></p>
<p>Yep, I am investigating benchmarks with llvm tip and I can
see the llvm fails to unroll some loops with multiple exits.<o:p></o:p></p>
<p class="MsoNormal">> B) One of your exits does not dominate
your latch.� Those are generally hard<o:p></o:p></p>
<p class="MsoNormal">> C) This example does not seem to
require gotos.� I strongly suggest reducing your test cases
if you want more informed commentary.�<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am looking at perlbench recently and it
has `goto` statements inside loop. The example is a reduced
case. </p>
</div>
</blockquote>
Right, but the gotos aren't relevant for your reduced test. You can
reduce further.<br>
<blockquote type="cite"
cite="mid:VE1PR08MB46703D0BDC5DA20A0BDF71F199119@VE1PR08MB4670.eurprd08.prod.outlook.com">
<div class="WordSection1">
<p class="MsoNormal">When I look at the gcc’s output of the
example, it looks like gcc unrolls only the below `if`
statement block…<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> if (*s++ != '\n')<o:p></o:p></p>
<p class="MsoNormal"> continue;</p>
</div>
</blockquote>
Your phrasing here does not parse for me. Can you restate this with
different wording and maybe a fully worked example?<br>
<blockquote type="cite"
cite="mid:VE1PR08MB46703D0BDC5DA20A0BDF71F199119@VE1PR08MB4670.eurprd08.prod.outlook.com">
<div class="WordSection1">
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks<o:p></o:p></p>
<p class="MsoNormal">JinGu Kang<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm
0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>From:</b> llvm-dev
<a class="moz-txt-link-rfc2396E" href="mailto:llvm-dev-bounces@lists.llvm.org"><llvm-dev-bounces@lists.llvm.org></a> <b>On Behalf Of
</b>Philip Reames via llvm-dev<br>
<b>Sent:</b> 16 July 2021 15:52<br>
<b>To:</b> Jingu Kang <a class="moz-txt-link-rfc2396E" href="mailto:Jingu.Kang@arm.com"><Jingu.Kang@arm.com></a>;
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] Question about Unrolling
Loop with Multiple Exits<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>A) Are you measuring on tip of tree?� There were changes
for multiple exit unrolling which landed very recently.<o:p></o:p></p>
<p>B) One of your exits does not dominate your latch.� Those
are generally hard.�
<o:p></o:p></p>
<p>C) This example does not seem to require gotos.� I
strongly suggest reducing your test cases if you want more
informed commentary.�
<o:p></o:p></p>
<p>Philip<o:p></o:p></p>
<div>
<p class="MsoNormal">On 7/16/21 7:42 AM, Jingu Kang via
llvm-dev wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Hi All,<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">While I am investigating benchmarks, I
have found loops which llvm fails to unroll because the
loops have multiple exits.<o:p></o:p></p>
<p class="MsoNormal">For example, <o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">char *foo(void);<o:p></o:p></p>
<p class="MsoNormal">int boo(char *s);<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">int test(char *s, char *end, char
*check1, char *check2) {<o:p></o:p></p>
<p class="MsoNormal">� while (s <= end) {<o:p></o:p></p>
<p class="MsoNormal">��� if (*s++ != '\n')<o:p></o:p></p>
<p class="MsoNormal">����� continue;<o:p></o:p></p>
<p class="MsoNormal">��� if (check1 || check2) {<o:p></o:p></p>
<p class="MsoNormal">����� s = foo();<o:p></o:p></p>
<p class="MsoNormal">����� if (!s)<o:p></o:p></p>
<p class="MsoNormal">������� goto ret1;<o:p></o:p></p>
<p class="MsoNormal">��� }�� <o:p></o:p></p>
<p class="MsoNormal">����if (boo(s))<o:p></o:p></p>
<p class="MsoNormal">����� goto ret0;<o:p></o:p></p>
<p class="MsoNormal">� }<o:p></o:p></p>
<p class="MsoNormal">� goto ret1;<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">ret0:<o:p></o:p></p>
<p class="MsoNormal">� return 0;<o:p></o:p></p>
<p class="MsoNormal">ret1:<o:p></o:p></p>
<p class="MsoNormal">� return 1;<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">Above code causes below messages from
LoopUnroll pass.<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">Bailout for multi-exit handling when
latch exit has >1 predecessor.<o:p></o:p></p>
<p class="MsoNormal">Multiple exit/exiting blocks in loop
and multi-exit unrolling not enabled!<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">I can see the option
`unroll-runtime-multi-exit` and comments about it. I
wonder there are already reviews for the work on
phabriactor or some people are working on it.<o:p></o:p></p>
<p class="MsoNormal">If someone knows information about it,
please share it.<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">Thanks<o:p></o:p></p>
<p class="MsoNormal">JinGu Kang<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal">�<o:p></o:p></p>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>LLVM Developers mailing list<o:p></o:p></pre>
<pre><a href="mailto:llvm-dev@lists.llvm.org" moz-do-not-send="true">llvm-dev@lists.llvm.org</a><o:p></o:p></pre>
<pre><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></pre>
</blockquote>
</div>
</div>
</blockquote>
</body>
</html>