[LLVMdev] GSoC:Loop Reversal Transformation

vishal sarda vishalksarda at gmail.com
Wed Mar 18 08:33:10 PDT 2015


Hi Matt, All,

Thanks for looking into this and your suggestions.

I compiled the program with -O3 optimization level (clang -O3) on X86_64
target.
After your suggestion, i ran the program with iteration of 10000 runs and
found that average runtimes are (attaching data collected as well)

Forward loop traverse : 2.006 milli seconds
Reverse loop traverse : 1.531 milli seconds

Yes, i agree that this sample program may not be sufficient to say that
loop reversal traversing will always be faster, however, difference in
runtime is visible though. And that's where the profitability calculation
comes into picture.

I found mention of loop traverse in various papers (links mentioned in
previous mail), and hence thought of implementing it.

I am not sure though if its really helpful. Above papers mentioned that it
might not be beneficial in itself, but opens up the opportunity for other
optimizations.

Suggestions on this are most welcomed. Waiting for others to pitch in too.

Regards,
Vishal Sarda,
3rd Year Undergraduate,
Department of Computer Engineering,
College of Engineering, Pune

On Wed, Mar 18, 2015 at 1:20 AM, Matt Godbolt <matt at godbolt.org> wrote:

> Hi,
>
> On Tue, Mar 17, 2015 at 2:00 PM, vishal sarda <vishalksarda at gmail.com>
> wrote:
>
>> [snip]
>>
>> Loop counting up 0.15 ms
>>
>> Loop counting down 0.08 ms
>>
> I'm no llvm expert, but as an interest bystander: I suspect you compiled
> the source without any optimizations applied - I tried to replicate this
> behaviour and found the optimzer happily replaces both the inner loops you
> had with a constant, and thus I got the same time on both loops. (e.g. see
> http://goo.gl/aXFkVb )
>
> Benchmarks of this nature where the run time is so small are notoriously
> prone to measurement errors, so I'd be a little careful drawing conclusions
> from the sample you listed. Also; what architecture did you measure on, and
> what spec machine?
>
> Not at all to dissuade you from investigating this optimization! I'm just
> a little sceptical of the benchmark you posted!
>
> Best regards,
>
> Matt
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150318/ecd31c8c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Compare.xlsx
Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Size: 276128 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150318/ecd31c8c/attachment.xlsx>


More information about the llvm-dev mailing list