[LLVMdev] Partial loop unrolling
Mahesha S
mahesha.llvm at gmail.com
Tue Jul 15 04:34:21 PDT 2014
Hi,
PS: It is a generic question related to partial loop unrolling, and nothing
specific to LLVM.
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);
}
2. Second possibility
for (i = 0; i < 7; i++)
{
do_foo(i);
}
do_foo(i++);
do_foo(i++);
do_foo(i++);
3. Third possibility
for (i = 0; i < 10;)
{
do_foo(i++);
do_foo(i++);
do_foo(i++);
}
My questions are:
a. In case, if we get any performance improvement due to partial loop
unrolling, are all the three possibilities give almost same performance
improvement?
b. If answer to question 'a' is 'no', then which one of these three
possibilities is ideal for generic partial unrolling implementation? and in
general, which one of these is implemented in production compilers? and in
particular, which one of these is implemented in LLVM compiler?
--
mahesha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140715/3e3819bd/attachment.html>
More information about the llvm-dev
mailing list