[llvm-dev] Question about Unrolling Loop with Multiple Exits
Philip Reames via llvm-dev
llvm-dev at lists.llvm.org
Fri Jul 16 07:52:18 PDT 2021
A) Are you measuring on tip of tree? There were changes for multiple
exit unrolling which landed very recently.
B) One of your exits does not dominate your latch. Those are generally
hard.
C) This example does not seem to require gotos. I strongly suggest
reducing your test cases if you want more informed commentary.
Philip
On 7/16/21 7:42 AM, Jingu Kang via llvm-dev wrote:
>
> Hi All,
>
> While I am investigating benchmarks, I have found loops which llvm
> fails to unroll because the loops have multiple exits.
>
> For example,
>
> char *foo(void);
>
> int boo(char *s);
>
> int test(char *s, char *end, char *check1, char *check2) {
>
> while (s <= end) {
>
> if (*s++ != '\n')
>
> continue;
>
> if (check1 || check2) {
>
> s = foo();
>
> if (!s)
>
> goto ret1;
>
> }
>
> if (boo(s))
>
> goto ret0;
>
> }
>
> goto ret1;
>
> ret0:
>
> return 0;
>
> ret1:
>
> return 1;
>
> }
>
> Above code causes below messages from LoopUnroll pass.
>
> Bailout for multi-exit handling when latch exit has >1 predecessor.
>
> Multiple exit/exiting blocks in loop and multi-exit unrolling not enabled!
>
> 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.
>
> If someone knows information about it, please share it.
>
> Thanks
>
> JinGu Kang
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210716/abcd8085/attachment.html>
More information about the llvm-dev
mailing list