[LLVMdev] Partial loop unrolling

Mahesha S mahesha.llvm at gmail.com
Thu Jul 17 02:25:03 PDT 2014


On Wed, Jul 16, 2014 at 11:00 PM, Krzysztof Parzyszek <
kparzysz at codeaurora.org> wrote:

> 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.



I understand. I must agree that, I am newbee when it comes to compiler
optimization techniques and nomenclature

>
>
>
>  3. Third possibility
>>        for (i = 0; i < 10;)
>>        {
>>             do_foo(i++);
>>             do_foo(i++);
>>             do_foo(i++);
>>        }
>>
>
> This one is unrolled, but incorrectly.



I think I understood the mistake here. In fact, I noticed it just after
shooting my initial mail. One of the correct ways may be below one.


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


--
mahesha



>
>
> -Krzysztof
>
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
> by The Linux Foundation
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



-- 
mahesha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140717/47acdaca/attachment.html>


More information about the llvm-dev mailing list