helping the compiler with asserts-hints to optimize
Agustin Perez Paladini
agudpp@gmail.com
Thu Apr 24 16:08:00 GMT 2014
OK I will do it later today!
Thanks Jeff.
2014-04-24 12:32 GMT-03:00 Jeff Law <law@redhat.com>:
> On 04/24/14 06:40, Agustin Perez Paladini wrote:
>>
>>
>> int
>> fun_module(int a)
>> {
>> ASSUME(a % 4 == 0);
>>
>> if (a == 3) {
>> return 123;
>> }
>> return 789;
>> }
>>
>> giving this asm
>>
>> fun_module:
>> .LFB3:
>> .cfi_startproc
>> cmpl $3, 4(%esp)
>> movl $789, %edx
>> movl $123, %eax
>> cmovne %edx, %eax
>> ret
>> .cfi_endproc
>>
>>
>> Anyway, I think its pretty much what I was looking for.
>
> Feel free to file a bug report for this one. VRP doesn't have a
> nonzero/zero bits tracking lattice, but it's something I can see being added
> at some point and having examples like this in the BZ database is often
> helpful when doing that kind of optimization work.
>
> Thanks,
>
> Jeff
More information about the Gcc-help
mailing list