[llvm-commits] [LLVM, loop-unswitch, bugfix for #11429] Wrong behaviour for switches.

Stepan Dyatkovskiy STPWORLD at narod.ru
Thu Dec 29 01:37:48 PST 2011


Ping.

-Stepan

28.12.2011, 14:42, "Stepan Dyatkovskiy" <stpworld at narod.ru>:
> Hi. A made some fixes that improves compile-time:
>
> 1. Size heuristics changed. Now we calculate number of unswitching
> branches only once per loop.
> 2. Some checks was moved from UnswitchIfProfitable to
> processCurrentLoop, since it is not changed during processCurrentLoop
> iteration. It allows decide to skip some loops at an early stage.
>
> I checked the compile-time on test
>
> MultiSource/Benchmarks/Prolangs-C++/shapes/shapes
> (there was compile time regression after my previous patch).
>
> Relative to previous patch the compile-time improved on ~8.5%. Relative
> to old revisions (before r146578) the compile time is improved on ~2%.
>
> Please find the patch in attachment for review.
>
> -Stepan.
>
> Stepan Dyatkovskiy wrote:
>
>>  Commited as r146578.
>>
>>  Thanks.
>>  -Stepan.
>>
>>  Dan Gohman wrote:
>>>  Thanks. The patch looks ok to me.
>>>
>>>  Dan
>>>
>>>  On Dec 10, 2011, at 6:22 AM, Stepan Dyatkovskiy wrote:
>>>>  I fixed code heuristics. How it works now:
>>>>
>>>>  1. Calculate average number of produced instructions and basics blocks:
>>>>  number-of-instructions=curret-loop->number-of-instructions * unswitched-number
>>>>  number-of-bb=curret-loop->number-of-bb * unswitched-number
>>>>
>>>>  2. If number-of-instructions>   Threshold || number-of-bb*5>   Threshold, stop unswitching.
>>>>
>>>>  By default Threshold is 50. But user can set custom threshold using -loop-unswitch-threshold<custom-threshold>   option. This option existed before my patch, and I kept it without changes though.
>>>>
>>>>  I compiled ffmpeg (ffmpeg.org) with llvm + clang toolchain (with and without my patch). I got the next results:
>>>>
>>>>  Without patch:   ffmpeg size is 7369612 bytes.
>>>>  Threshold = 50:  ffmpeg size is 7349132 bytes (less then in ToT version).
>>>>  Threshold = 200: ffmpeg size is 7439244 bytes.
>>>>
>>>>  I also checked the ffmpeg build time in all cases it was 2 mins, 35 secs.
>>>>  Transcoding time with ffmpeg (mp3 ->   mp2) in all cases was also the same: process took 1 min, 19 secs.
>>>>
>>>>  I added unit test that checks unswitch kicking in case of insufficient size. Unit tests and fixed patch (default threshold is 50) are attached to this post.
>>>>
>>>>  Thanks.
>>>>  -Stepan.
>>  _______________________________________________
>>  llvm-commits mailing list
>>  llvm-commits at cs.uiuc.edu
>>  http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list