<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<p>A) Are you measuring on tip of tree? There were changes for
multiple exit unrolling which landed very recently.</p>
<p>B) One of your exits does not dominate your latch. Those are
generally hard. <br>
</p>
<p>C) This example does not seem to require gotos. I strongly
suggest reducing your test cases if you want more informed
commentary. <br>
</p>
<p>Philip<br>
</p>
<div class="moz-cite-prefix">On 7/16/21 7:42 AM, Jingu Kang via
llvm-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:VE1PR08MB4670F6BBEB3D77FE512F0F6299119@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:"\@Malgun Gothic";}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}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 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>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
</body>
</html>