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

Stepan Dyatkovskiy stpworld at narod.ru
Wed Dec 14 11:23:48 PST 2011


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




More information about the llvm-commits mailing list