[LLVMdev] Partial loop unrolling

Krzysztof Parzyszek kparzysz at codeaurora.org
Wed Jul 16 10:30:25 PDT 2014


On 7/15/2014 6:34 AM, Mahesha S wrote:
>
> As far as partial loop unrolling is concerned, I could see following
> three different possibilities. Assume that unroll factor is 3.
>
> Original loop:
>        for (i = 0; i < 10; i++)
>        {
>             do_foo(i);
>        }
>
> 1. First possibility
>        i = 0;
>        do_foo(i++);
>        do_foo(i++);
>        do_foo(i++);
>        for (; i < 10; i++)
>        {
>             do_foo(i);
>        }

This is really peeling, not unrolling.


> 2. Second possibility
>        for (i = 0; i < 7; i++)
>        {
>             do_foo(i);
>        }
>        do_foo(i++);
>        do_foo(i++);
>        do_foo(i++);

Same as above.


> 3. Third possibility
>        for (i = 0; i < 10;)
>        {
>             do_foo(i++);
>             do_foo(i++);
>             do_foo(i++);
>        }

This one is unrolled, but incorrectly.


-Krzysztof


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-dev mailing list